From 2af9046e133c62cf2c83f07b1657d85ea6bd09da Mon Sep 17 00:00:00 2001 From: Prateek Pandey Date: Thu, 5 May 2022 19:49:19 +0530 Subject: [PATCH] refact: disable leader for update request controller (#3807) Signed-off-by: prateekpandey14 --- cmd/kyverno/main.go | 2 +- pkg/background/update_request_controller.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/kyverno/main.go b/cmd/kyverno/main.go index ccd209e52b..02d9a417c2 100755 --- a/cmd/kyverno/main.go +++ b/cmd/kyverno/main.go @@ -429,7 +429,6 @@ func main() { go certManager.Run(stopCh) go policyCtrl.Run(2, prgen.ReconcileCh, stopCh) go prgen.Run(1, stopCh) - go urc.Run(genWorkers, stopCh) go grcc.Run(1, stopCh) } @@ -460,6 +459,7 @@ func main() { // init events handlers // start Kyverno controllers + go urc.Run(genWorkers, stopCh) go le.Run(ctx) go reportReqGen.Run(2, stopCh) go configurationController.Run(stopCh) diff --git a/pkg/background/update_request_controller.go b/pkg/background/update_request_controller.go index a1b6fe0026..892ad0a3f5 100644 --- a/pkg/background/update_request_controller.go +++ b/pkg/background/update_request_controller.go @@ -109,9 +109,12 @@ func NewController( // Run starts workers func (c *Controller) Run(workers int, stopCh <-chan struct{}) { + logger := c.log defer utilruntime.HandleCrash() defer c.queue.ShutDown() - defer c.log.Info("shutting down") + + logger.Info("starting") + defer logger.Info("shutting down") c.policyInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ UpdateFunc: c.updatePolicy, // We only handle updates to policy