From e6e322bc381e9af6b6d8b6db32b949399675fdde Mon Sep 17 00:00:00 2001 From: zachaller Date: Wed, 4 Oct 2023 16:19:25 -0500 Subject: [PATCH] sync notification controller configmaps/secrets first before starting other informers Signed-off-by: zachaller --- controller/controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/controller/controller.go b/controller/controller.go index 5429cfe743..afe4bc769b 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -463,6 +463,12 @@ func (c *Manager) startLeading(ctx context.Context, rolloutThreadiness, serviceT // Start the informer factories to begin populating the informer caches log.Info("Starting Controllers") + c.notificationConfigMapInformerFactory.Start(ctx.Done()) + c.notificationSecretInformerFactory.Start(ctx.Done()) + if ok := cache.WaitForCacheSync(ctx.Done(), c.configMapSynced, c.secretSynced); !ok { + log.Fatalf("failed to wait for configmap/secret caches to sync, exiting") + } + // notice that there is no need to run Start methods in a separate goroutine. (i.e. go kubeInformerFactory.Start(stopCh) // Start method is non-blocking and runs all registered informers in a dedicated goroutine. c.dynamicInformerFactory.Start(ctx.Done()) @@ -471,9 +477,6 @@ func (c *Manager) startLeading(ctx context.Context, rolloutThreadiness, serviceT } c.kubeInformerFactory.Start(ctx.Done()) - c.notificationConfigMapInformerFactory.Start(ctx.Done()) - c.notificationSecretInformerFactory.Start(ctx.Done()) - c.jobInformerFactory.Start(ctx.Done()) // Check if Istio installed on cluster before starting dynamicInformerFactory