INNER CODE UNIT · Go
func
airwallex/k8s-pod-restart-info-collector · controller.go:93
func (c *Controller) Run(workers int, stopCh chan struct{}) {
defer runtime.HandleCrash()
// Let the workers stop when we are done
defer c.queue.ShutDown()
klog.Info("Starting controller")
// Starts all the shared informers that have been created by the factory so
// far.
go c.informerFactory.Start(stopCh)
// Wait for all involved caches to be synced, before processing items from the queue is started
if !cache.WaitForCacheSync(stopCh, c.podInformer.Informer().HasSynced) {
runtime.HandleError(fmt.Errorf("timed out waiting for caches to sync"))
return
}
for i := 0; i < workers; i++ {