diff --git a/pkg/internal/controller/controller.go b/pkg/internal/controller/controller.go index 9fa7ec71e1..e02c07c9ba 100644 --- a/pkg/internal/controller/controller.go +++ b/pkg/internal/controller/controller.go @@ -197,9 +197,16 @@ func (c *Controller[request]) Start(ctx context.Context) error { for i := 0; i < c.MaxConcurrentReconciles; i++ { go func() { defer wg.Done() + queueCtx := context.WithoutCancel(ctx) // Run a worker thread that just dequeues items, processes them, and marks them done. // It enforces that the reconcileHandler is never invoked concurrently with the same object. - for c.processNextWorkItem(ctx) { + Process: + for c.processNextWorkItem(queueCtx) { + select { + case <-ctx.Done(): + break Process + default: + } } }() }