Reconcile- kindNs Strategy
Source: hello-pepr-reconcile-kindns
The Reconcile action provides ordered, asynchronous processing of Kubernetes resource changes. The kindNs strategy creates one queue per kind within each namespace, allowing resources in different namespaces to be processed in parallel while maintaining order within each kind-namespace combination.
When to Use
Section titled “When to Use”Use the kindNs strategy when you need:
- Ordering guarantees within each kind per namespace
- Parallel processing across namespaces
- Isolation between namespace workloads
- Multi-tenant environments where namespace isolation is important
Trade-off: Resources of the same kind in the same namespace share a queue, but different namespaces can process independently in parallel.
Code Examples
Section titled “Code Examples”View full example on Github
Module Configuration in package.json:
{ "pepr": { "env": { "PEPR_RECONCILE_STRATEGY": "kindNs" } }}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 kindNs strategy:
- ConfigMaps in
hello-pepr-reconcile-onehave their own queue - Secrets in
hello-pepr-reconcile-onehave their own queue - Secrets in
hello-pepr-reconcile-twohave their own queue - All three queues can process in parallel
Example scenario:
cm-slow(ConfigMap in ns-one) is created → starts processing (500ms)se-slow(Secret in ns-one) is created → starts processing in parallel (500ms, different queue)se-fast(Secret in ns-two) is created → starts processing in parallel (300ms, different namespace queue)- All three process simultaneously
Processing order guarantee:
- ConfigMaps in
hello-pepr-reconcile-oneare processed in order - Secrets in
hello-pepr-reconcile-oneare processed in order (independently from ConfigMaps) - Secrets in
hello-pepr-reconcile-twoare processed in order (independently from ns-one) - Namespace boundaries provide natural parallelization