From ba6ed642a188cf925a99d3fafe093cb60e1abd5e Mon Sep 17 00:00:00 2001 From: Tomas Nozicka Date: Fri, 24 Nov 2017 22:02:28 +0100 Subject: [PATCH] Wait for controllerrevision informer to sync on statefulset controller startup --- pkg/controller/statefulset/stateful_set.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/controller/statefulset/stateful_set.go b/pkg/controller/statefulset/stateful_set.go index e9db4c10b44..a49ba7deb3c 100644 --- a/pkg/controller/statefulset/stateful_set.go +++ b/pkg/controller/statefulset/stateful_set.go @@ -71,6 +71,8 @@ type StatefulSetController struct { setListerSynced cache.InformerSynced // pvcListerSynced returns true if the pvc shared informer has synced at least once pvcListerSynced cache.InformerSynced + // revListerSynced returns true if the rev shared informer has synced at least once + revListerSynced cache.InformerSynced // StatefulSets that need to be synced. queue workqueue.RateLimitingInterface } @@ -103,6 +105,8 @@ func NewStatefulSetController( pvcListerSynced: pvcInformer.Informer().HasSynced, queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "statefulset"), podControl: controller.RealPodControl{KubeClient: kubeClient, Recorder: recorder}, + + revListerSynced: revInformer.Informer().HasSynced, } podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ @@ -146,7 +150,7 @@ func (ssc *StatefulSetController) Run(workers int, stopCh <-chan struct{}) { glog.Infof("Starting stateful set controller") defer glog.Infof("Shutting down statefulset controller") - if !controller.WaitForCacheSync("stateful set", stopCh, ssc.podListerSynced, ssc.setListerSynced, ssc.pvcListerSynced) { + if !controller.WaitForCacheSync("stateful set", stopCh, ssc.podListerSynced, ssc.setListerSynced, ssc.pvcListerSynced, ssc.revListerSynced) { return }