mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #56356 from tnozicka/fix-statefulset-creating-controllerrevision-multiple-times
Automatic merge from submit-queue (batch tested with PRs 56356, 56435). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Wait for controllerrevision informer to sync on statefulset controller startup Fixes: https://github.com/kubernetes/kubernetes/issues/56355 Needs to be backported to at least 1.8, 1.9 and triaged for impact on 1.9 release /cc @smarterclayton @kow3ns @enisoc **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user