Skip to content

Commit

Permalink
Wait for initial cache to sync before starting autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
domenicbozzuto committed Oct 21, 2024
1 parent 7d051cc commit 95642ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cluster-autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,13 @@ func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter
// additional informers might have been registered in the factory during NewAutoscaler.
stop := make(chan struct{})
informerFactory.Start(stop)
testP, err := opts.AutoscalingKubeClients.ListerRegistry.AllPodLister().List()
klog.V(1).Infof("initial pods: %v (%v)", testP, err)
klog.V(1).Info("Started shared informer factory, waiting for initial cache sync")

syncStart := time.Now()
informerFactory.WaitForCacheSync(stop)
klog.V(1).Infof("Shared informer factory initialized, took %v", time.Since(syncStart))

return autoscaler, nil
}
Expand Down

0 comments on commit 95642ff

Please sign in to comment.