Fix namespace controller logging to be consistent
time.Now() was wrong, simplify namespace controller output
This commit is contained in:
parent
4f35b31fc7
commit
7da310ea28
@ -155,7 +155,9 @@ func (nm *NamespaceController) worker() {
|
|||||||
// syncNamespaceFromKey looks for a namespace with the specified key in its store and synchronizes it
|
// syncNamespaceFromKey looks for a namespace with the specified key in its store and synchronizes it
|
||||||
func (nm *NamespaceController) syncNamespaceFromKey(key string) (err error) {
|
func (nm *NamespaceController) syncNamespaceFromKey(key string) (err error) {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
defer glog.V(4).Infof("Finished syncing namespace %q (%v)", key, time.Now().Sub(startTime))
|
defer func() {
|
||||||
|
glog.V(4).Infof("Finished syncing namespace %q (%v)", key, time.Now().Sub(startTime))
|
||||||
|
}()
|
||||||
|
|
||||||
namespace, err := nm.lister.Get(key)
|
namespace, err := nm.lister.Get(key)
|
||||||
if errors.IsNotFound(err) {
|
if errors.IsNotFound(err) {
|
||||||
@ -174,16 +176,14 @@ func (nm *NamespaceController) Run(workers int, stopCh <-chan struct{}) {
|
|||||||
defer utilruntime.HandleCrash()
|
defer utilruntime.HandleCrash()
|
||||||
defer nm.queue.ShutDown()
|
defer nm.queue.ShutDown()
|
||||||
|
|
||||||
glog.Info("Starting namespace controller")
|
|
||||||
defer glog.Infof("Shutting down namespace controller")
|
|
||||||
|
|
||||||
if !controller.WaitForCacheSync("namespace", stopCh, nm.listerSynced) {
|
if !controller.WaitForCacheSync("namespace", stopCh, nm.listerSynced) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glog.V(5).Info("Starting workers")
|
||||||
for i := 0; i < workers; i++ {
|
for i := 0; i < workers; i++ {
|
||||||
go wait.Until(nm.worker, time.Second, stopCh)
|
go wait.Until(nm.worker, time.Second, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
<-stopCh
|
<-stopCh
|
||||||
|
glog.V(1).Infof("Shutting down")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user