Skip to content

Commit 24f68f9

Browse files
committed
Block cluster autoscaler until API resource caches are synced.
1 parent a58d346 commit 24f68f9

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
@@ -638,6 +638,14 @@ func buildAutoscaler(context ctx.Context, debuggingSnapshotter debuggingsnapshot
638638
stop := make(chan struct{})
639639
informerFactory.Start(stop)
640640

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

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

0 commit comments

Comments
 (0)