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:
@@ -21,8 +21,8 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/klog"
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
"k8s.io/kubernetes/pkg/kubelet/util/format"
|
||||
@@ -51,15 +51,15 @@ func (kl *Kubelet) RunOnce(updates <-chan kubetypes.PodUpdate) ([]RunPodResult,
|
||||
// If the container logs directory does not exist, create it.
|
||||
if _, err := os.Stat(ContainerLogsDir); err != nil {
|
||||
if err := kl.os.MkdirAll(ContainerLogsDir, 0755); err != nil {
|
||||
glog.Errorf("Failed to create directory %q: %v", ContainerLogsDir, err)
|
||||
klog.Errorf("Failed to create directory %q: %v", ContainerLogsDir, err)
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case u := <-updates:
|
||||
glog.Infof("processing manifest with %d pods", len(u.Pods))
|
||||
klog.Infof("processing manifest with %d pods", len(u.Pods))
|
||||
result, err := kl.runOnce(u.Pods, runOnceRetryDelay)
|
||||
glog.Infof("finished processing %d pods", len(u.Pods))
|
||||
klog.Infof("finished processing %d pods", len(u.Pods))
|
||||
return result, err
|
||||
case <-time.After(runOnceManifestDelay):
|
||||
return nil, fmt.Errorf("no pod manifest update after %v", runOnceManifestDelay)
|
||||
@@ -85,7 +85,7 @@ func (kl *Kubelet) runOnce(pods []*v1.Pod, retryDelay time.Duration) (results []
|
||||
}(pod)
|
||||
}
|
||||
|
||||
glog.Infof("Waiting for %d pods", len(admitted))
|
||||
klog.Infof("Waiting for %d pods", len(admitted))
|
||||
failedPods := []string{}
|
||||
for i := 0; i < len(admitted); i++ {
|
||||
res := <-ch
|
||||
@@ -93,19 +93,19 @@ func (kl *Kubelet) runOnce(pods []*v1.Pod, retryDelay time.Duration) (results []
|
||||
if res.Err != nil {
|
||||
faliedContainerName, err := kl.getFailedContainers(res.Pod)
|
||||
if err != nil {
|
||||
glog.Infof("unable to get failed containers' names for pod %q, error:%v", format.Pod(res.Pod), err)
|
||||
klog.Infof("unable to get failed containers' names for pod %q, error:%v", format.Pod(res.Pod), err)
|
||||
} else {
|
||||
glog.Infof("unable to start pod %q because container:%v failed", format.Pod(res.Pod), faliedContainerName)
|
||||
klog.Infof("unable to start pod %q because container:%v failed", format.Pod(res.Pod), faliedContainerName)
|
||||
}
|
||||
failedPods = append(failedPods, format.Pod(res.Pod))
|
||||
} else {
|
||||
glog.Infof("started pod %q", format.Pod(res.Pod))
|
||||
klog.Infof("started pod %q", format.Pod(res.Pod))
|
||||
}
|
||||
}
|
||||
if len(failedPods) > 0 {
|
||||
return results, fmt.Errorf("error running pods: %v", failedPods)
|
||||
}
|
||||
glog.Infof("%d pods started", len(pods))
|
||||
klog.Infof("%d pods started", len(pods))
|
||||
return results, err
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ func (kl *Kubelet) runPod(pod *v1.Pod, retryDelay time.Duration) error {
|
||||
}
|
||||
|
||||
if kl.isPodRunning(pod, status) {
|
||||
glog.Infof("pod %q containers running", format.Pod(pod))
|
||||
klog.Infof("pod %q containers running", format.Pod(pod))
|
||||
return nil
|
||||
}
|
||||
glog.Infof("pod %q containers not running: syncing", format.Pod(pod))
|
||||
klog.Infof("pod %q containers not running: syncing", format.Pod(pod))
|
||||
|
||||
glog.Infof("Creating a mirror pod for static pod %q", format.Pod(pod))
|
||||
klog.Infof("Creating a mirror pod for static pod %q", format.Pod(pod))
|
||||
if err := kl.podManager.CreateMirrorPod(pod); err != nil {
|
||||
glog.Errorf("Failed creating a mirror pod %q: %v", format.Pod(pod), err)
|
||||
klog.Errorf("Failed creating a mirror pod %q: %v", format.Pod(pod), err)
|
||||
}
|
||||
mirrorPod, _ := kl.podManager.GetMirrorPodByPod(pod)
|
||||
if err = kl.syncPod(syncPodOptions{
|
||||
@@ -142,7 +142,7 @@ func (kl *Kubelet) runPod(pod *v1.Pod, retryDelay time.Duration) error {
|
||||
return fmt.Errorf("timeout error: pod %q containers not running after %d retries", format.Pod(pod), runOnceMaxRetries)
|
||||
}
|
||||
// TODO(proppy): health checking would be better than waiting + checking the state at the next iteration.
|
||||
glog.Infof("pod %q containers synced, waiting for %v", format.Pod(pod), delay)
|
||||
klog.Infof("pod %q containers synced, waiting for %v", format.Pod(pod), delay)
|
||||
time.Sleep(delay)
|
||||
retry++
|
||||
delay *= runOnceRetryDelayBackoff
|
||||
@@ -154,7 +154,7 @@ func (kl *Kubelet) isPodRunning(pod *v1.Pod, status *kubecontainer.PodStatus) bo
|
||||
for _, c := range pod.Spec.Containers {
|
||||
cs := status.FindContainerStatusByName(c.Name)
|
||||
if cs == nil || cs.State != kubecontainer.ContainerStateRunning {
|
||||
glog.Infof("Container %q for pod %q not running", c.Name, format.Pod(pod))
|
||||
klog.Infof("Container %q for pod %q not running", c.Name, format.Pod(pod))
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user