mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Make controller Run methods consistent
- startup/shutdown logging - wait for cache sync logging - defer utilruntime.HandleCrash() - wait for stop channel before exiting
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
coreinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/core/v1"
|
||||
corelisters "k8s.io/kubernetes/pkg/client/listers/core/v1"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/util/metrics"
|
||||
)
|
||||
|
||||
@@ -109,10 +110,10 @@ func (c *ServiceAccountsController) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
glog.Infof("Starting ServiceAccount controller")
|
||||
glog.Infof("Starting service account controller")
|
||||
defer glog.Infof("Shutting down service account controller")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, c.saListerSynced, c.nsListerSynced) {
|
||||
utilruntime.HandleError(fmt.Errorf("timed out waiting for caches to sync"))
|
||||
if !controller.WaitForCacheSync("service account", stopCh, c.saListerSynced, c.nsListerSynced) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -121,7 +122,6 @@ func (c *ServiceAccountsController) Run(workers int, stopCh <-chan struct{}) {
|
||||
}
|
||||
|
||||
<-stopCh
|
||||
glog.Infof("Shutting down ServiceAccount controller")
|
||||
}
|
||||
|
||||
// serviceAccountDeleted reacts to a ServiceAccount deletion by recreating a default ServiceAccount in the namespace if needed
|
||||
|
||||
Reference in New Issue
Block a user