Kubernetes Workqueue and Concurrent Reconciling
Kubernetes controllers support concurrent reconciliation via MaxConcurrentReconciles. Multiple workers can process different resources in parallel, but the workqueue guarantees a single resource is never processed by two workers at the same time. Workqueue Internals The client-go workqueue uses three data structures: queue - ordered list of items waiting to be processed dirty set - all items that need processing (used for deduplication) processing set - items currently being worked on by a worker ┌─────────────────────────────────────────────────┐ │ Workqueue │ │ │ │ dirty set: tracks items needing reconciliation │ │ processing set: tracks items being reconciled │ │ queue: ordered list for workers to pick from │ │ │ └─────────────────────────────────────────────────┘ Adding an Item While It’s Being Processed Yes, you can add an item to the queue while it’s being processed. The workqueue handles it: ...