Commit ba6ed642 authored by Tomas Nozicka's avatar Tomas Nozicka

Wait for controllerrevision informer to sync on statefulset controller startup

parent 6b1b6d50
...@@ -71,6 +71,8 @@ type StatefulSetController struct { ...@@ -71,6 +71,8 @@ type StatefulSetController struct {
setListerSynced cache.InformerSynced setListerSynced cache.InformerSynced
// pvcListerSynced returns true if the pvc shared informer has synced at least once // pvcListerSynced returns true if the pvc shared informer has synced at least once
pvcListerSynced cache.InformerSynced 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. // StatefulSets that need to be synced.
queue workqueue.RateLimitingInterface queue workqueue.RateLimitingInterface
} }
...@@ -103,6 +105,8 @@ func NewStatefulSetController( ...@@ -103,6 +105,8 @@ func NewStatefulSetController(
pvcListerSynced: pvcInformer.Informer().HasSynced, pvcListerSynced: pvcInformer.Informer().HasSynced,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "statefulset"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "statefulset"),
podControl: controller.RealPodControl{KubeClient: kubeClient, Recorder: recorder}, podControl: controller.RealPodControl{KubeClient: kubeClient, Recorder: recorder},
revListerSynced: revInformer.Informer().HasSynced,
} }
podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
...@@ -146,7 +150,7 @@ func (ssc *StatefulSetController) Run(workers int, stopCh <-chan struct{}) { ...@@ -146,7 +150,7 @@ func (ssc *StatefulSetController) Run(workers int, stopCh <-chan struct{}) {
glog.Infof("Starting stateful set controller") glog.Infof("Starting stateful set controller")
defer glog.Infof("Shutting down statefulset 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 return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment