Skip to content

Commit 173a4bd

Browse files
authored
Merge pull request #7897 from mtrqq/bug/block-until-resource-caches-are-synced
Block cluster autoscaler until API resource caches are synced.
2 parents 5e7a559 + 24f68f9 commit 173a4bd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cluster-autoscaler/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,14 @@ func buildAutoscaler(context ctx.Context, debuggingSnapshotter debuggingsnapshot
640640
stop := make(chan struct{})
641641
informerFactory.Start(stop)
642642

643+
klog.Info("Initializing resource informers, blocking until caches are synced")
644+
informersSynced := informerFactory.WaitForCacheSync(stop)
645+
for _, synced := range informersSynced {
646+
if !synced {
647+
return nil, nil, fmt.Errorf("unable to start and sync resource informers")
648+
}
649+
}
650+
643651
podObserver := loop.StartPodObserver(context, kube_util.CreateKubeClient(autoscalingOptions.KubeClientOpts))
644652

645653
// A ProvisioningRequestPodsInjector is used as provisioningRequestProcessingTimesGetter here to obtain the last time a

0 commit comments

Comments
 (0)