Reconcile - Global Strategy
Source: hello-pepr-reconcile-global
The Reconcile action provides ordered, asynchronous processing of Kubernetes resource changes. The global strategy consolidates all events into one queue, offering maximum ordering guarantees at the cost of throughput.
When to Use
Section titled “When to Use”Use the global strategy when you need:
- Strict ordering guarantees across all resources and kinds
- Sequential processing to prevent any race conditions
- Simple coordination across different resource types
- Strong consistency over performance
Trade-off: Lower throughput since all events are processed sequentially in a single queue, regardless of resource kind or namespace.
Code Examples
Section titled “Code Examples”View full example on Github
Module Configuration in package.json:
{ "pepr": { "env": { "PEPR_RECONCILE_STRATEGY": "global" } }}Reconcile Actions:
When(a.ConfigMap) .IsCreatedOrUpdated() .InNamespace("hello-pepr-reconcile-one") .Reconcile(function keepsOrder(cm) { const { name } = cm.metadata;
if (name === "kube-root-ca.crt") { return; }
return name === "cm-slow" ? slow(cm) : name === "cm-fast" ? fast(cm) : oops(cm); });
When(a.Secret) .IsCreatedOrUpdated() .InNamespace("hello-pepr-reconcile-one", "hello-pepr-reconcile-two") .Reconcile(function keepsOrder(se) { const { name } = se.metadata;
return name === "se-slow" ? slow(se) : name === "se-fast" ? fast(se) : oops(se); });Behavior
Section titled “Behavior”With global strategy:
- All ConfigMaps and Secrets share one global queue
- Everything is processed strictly in order
- No parallel processing across any resource types
Example scenario:
cm-slow(ConfigMap) is created → starts processing (500ms)se-fast(Secret) is created → waits in global queuecm-fast(ConfigMap) is created → waits in global queuecm-slowcompletes →se-faststarts processing (300ms)se-fastcompletes →cm-faststarts processing (300ms)
Processing order guarantee:
- All resources (ConfigMaps, Secrets, everything) are processed in strict FIFO order
- No parallel processing - only one resource is reconciled at a time
- Complete ordering across all resource kinds and namespaces