Skip to content

Commit

Permalink
fix: sync notification controller configmaps/secrets first (#3075)
Browse files Browse the repository at this point in the history
sync notification controller configmaps/secrets first before starting other informers

Signed-off-by: zachaller <[email protected]>
  • Loading branch information
zachaller committed Oct 5, 2023
1 parent 8d7d655 commit 725dd4d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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
Expand Down

0 comments on commit 725dd4d

Please sign in to comment.