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,8 +24,8 @@ import (
"path"
"testing"
"github.com/golang/glog"
"github.com/kardianos/osext"
"k8s.io/klog"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/test/e2e/framework"
@@ -86,19 +86,19 @@ func (e *E2EServices) Stop() {
}()
if e.services != nil {
if err := e.services.kill(); err != nil {
glog.Errorf("Failed to stop services: %v", err)
klog.Errorf("Failed to stop services: %v", err)
}
}
if e.kubelet != nil {
if err := e.kubelet.kill(); err != nil {
glog.Errorf("Failed to stop kubelet: %v", err)
klog.Errorf("Failed to stop kubelet: %v", err)
}
}
if e.rmDirs != nil {
for _, d := range e.rmDirs {
err := os.RemoveAll(d)
if err != nil {
glog.Errorf("Failed to delete directory %s: %v", d, err)
klog.Errorf("Failed to delete directory %s: %v", d, err)
}
}
}
@@ -112,7 +112,7 @@ func RunE2EServices(t *testing.T) {
utilfeature.DefaultFeatureGate.SetFromMap(framework.TestContext.FeatureGates)
e := newE2EServices()
if err := e.run(t); err != nil {
glog.Fatalf("Failed to run e2e services: %v", err)
klog.Fatalf("Failed to run e2e services: %v", err)
}
}
@@ -143,7 +143,7 @@ func (e *E2EServices) collectLogFiles() {
if framework.TestContext.ReportDir == "" {
return
}
glog.Info("Fetching log files...")
klog.Info("Fetching log files...")
journaldFound := isJournaldAvailable()
for targetFileName, log := range e.logs {
targetLink := path.Join(framework.TestContext.ReportDir, targetFileName)
@@ -152,13 +152,13 @@ func (e *E2EServices) collectLogFiles() {
if len(log.JournalctlCommand) == 0 {
continue
}
glog.Infof("Get log file %q with journalctl command %v.", targetFileName, log.JournalctlCommand)
klog.Infof("Get log file %q with journalctl command %v.", targetFileName, log.JournalctlCommand)
out, err := exec.Command("journalctl", log.JournalctlCommand...).CombinedOutput()
if err != nil {
glog.Errorf("failed to get %q from journald: %v, %v", targetFileName, string(out), err)
klog.Errorf("failed to get %q from journald: %v, %v", targetFileName, string(out), err)
} else {
if err = ioutil.WriteFile(targetLink, out, 0644); err != nil {
glog.Errorf("failed to write logs to %q: %v", targetLink, err)
klog.Errorf("failed to write logs to %q: %v", targetLink, err)
}
}
continue
@@ -169,7 +169,7 @@ func (e *E2EServices) collectLogFiles() {
continue
}
if err := copyLogFile(file, targetLink); err != nil {
glog.Error(err)
klog.Error(err)
} else {
break
}