Move from glog to klog

- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
This commit is contained in:
Davanum Srinivas
2018-11-09 13:49:10 -05:00
parent 97baad34a7
commit 954996e231
1263 changed files with 10023 additions and 10076 deletions

View File

@@ -24,7 +24,7 @@ go_library(
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/util/workqueue:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@@ -47,7 +47,7 @@ import (
"k8s.io/client-go/util/workqueue"
"k8s.io/kubernetes/pkg/controller"
"github.com/golang/glog"
"k8s.io/klog"
)
type TTLController struct {
@@ -113,8 +113,8 @@ func (ttlc *TTLController) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer ttlc.queue.ShutDown()
glog.Infof("Starting TTL controller")
defer glog.Infof("Shutting down TTL controller")
klog.Infof("Starting TTL controller")
defer klog.Infof("Shutting down TTL controller")
if !controller.WaitForCacheSync("TTL", stopCh, ttlc.hasSynced) {
return
@@ -190,7 +190,7 @@ func (ttlc *TTLController) deleteNode(obj interface{}) {
func (ttlc *TTLController) enqueueNode(node *v1.Node) {
key, err := controller.KeyFunc(node)
if err != nil {
glog.Errorf("Couldn't get key for object %+v", node)
klog.Errorf("Couldn't get key for object %+v", node)
return
}
ttlc.queue.Add(key)
@@ -235,7 +235,7 @@ func getIntFromAnnotation(node *v1.Node, annotationKey string) (int, bool) {
}
intValue, err := strconv.Atoi(annotationValue)
if err != nil {
glog.Warningf("Cannot convert the value %q with annotation key %q for the node %q",
klog.Warningf("Cannot convert the value %q with annotation key %q for the node %q",
annotationValue, annotationKey, node.Name)
return 0, false
}
@@ -265,10 +265,10 @@ func (ttlc *TTLController) patchNodeWithAnnotation(node *v1.Node, annotationKey
}
_, err = ttlc.kubeClient.CoreV1().Nodes().Patch(node.Name, types.StrategicMergePatchType, patchBytes)
if err != nil {
glog.V(2).Infof("Failed to change ttl annotation for node %s: %v", node.Name, err)
klog.V(2).Infof("Failed to change ttl annotation for node %s: %v", node.Name, err)
return err
}
glog.V(2).Infof("Changed ttl annotation for node %s to %d seconds", node.Name, value)
klog.V(2).Infof("Changed ttl annotation for node %s to %d seconds", node.Name, value)
return nil
}