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:
@@ -23,7 +23,6 @@ import (
|
||||
"regexp"
|
||||
dstrings "strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -32,6 +31,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/uuid"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
"k8s.io/kubernetes/pkg/util/strings"
|
||||
@@ -385,7 +385,7 @@ func (plugin *rbdPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*vol
|
||||
// the deprecated format: /var/lib/kubelet/plugins/kubernetes.io/rbd/rbd/{pool}-image-{image}.
|
||||
// So we will try to check whether this old style global device mount path exist or not.
|
||||
// If existed, extract the sourceName from this old style path, otherwise return an error.
|
||||
glog.V(3).Infof("SourceName %s wrong, fallback to old format", sourceName)
|
||||
klog.V(3).Infof("SourceName %s wrong, fallback to old format", sourceName)
|
||||
sourceName, err = plugin.getDeviceNameFromOldMountPath(mounter, mountPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -415,7 +415,7 @@ func (plugin *rbdPlugin) ConstructBlockVolumeSpec(podUID types.UID, volumeName,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
glog.V(5).Infof("globalMapPathUUID: %v, err: %v", globalMapPathUUID, err)
|
||||
klog.V(5).Infof("globalMapPathUUID: %v, err: %v", globalMapPathUUID, err)
|
||||
globalMapPath := filepath.Dir(globalMapPathUUID)
|
||||
if len(globalMapPath) == 1 {
|
||||
return nil, fmt.Errorf("failed to retrieve volume plugin information from globalMapPathUUID: %v", globalMapPathUUID)
|
||||
@@ -680,10 +680,10 @@ func (r *rbdVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
r.rbdMounter.Image = image
|
||||
rbd, sizeMB, err := r.manager.CreateImage(r)
|
||||
if err != nil {
|
||||
glog.Errorf("rbd: create volume failed, err: %v", err)
|
||||
klog.Errorf("rbd: create volume failed, err: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
glog.Infof("successfully created rbd image %q", image)
|
||||
klog.Infof("successfully created rbd image %q", image)
|
||||
pv := new(v1.PersistentVolume)
|
||||
metav1.SetMetaDataAnnotation(&pv.ObjectMeta, volutil.VolumeDynamicallyCreatedByKey, "rbd-dynamic-provisioner")
|
||||
|
||||
@@ -824,12 +824,12 @@ func (b *rbdMounter) SetUp(fsGroup *int64) error {
|
||||
|
||||
func (b *rbdMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
// diskSetUp checks mountpoints and prevent repeated calls
|
||||
glog.V(4).Infof("rbd: attempting to setup at %s", dir)
|
||||
klog.V(4).Infof("rbd: attempting to setup at %s", dir)
|
||||
err := diskSetUp(b.manager, *b, dir, b.mounter, fsGroup)
|
||||
if err != nil {
|
||||
glog.Errorf("rbd: failed to setup at %s %v", dir, err)
|
||||
klog.Errorf("rbd: failed to setup at %s %v", dir, err)
|
||||
}
|
||||
glog.V(3).Infof("rbd: successfully setup at %s", dir)
|
||||
klog.V(3).Infof("rbd: successfully setup at %s", dir)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -847,18 +847,18 @@ func (c *rbdUnmounter) TearDown() error {
|
||||
}
|
||||
|
||||
func (c *rbdUnmounter) TearDownAt(dir string) error {
|
||||
glog.V(4).Infof("rbd: attempting to teardown at %s", dir)
|
||||
klog.V(4).Infof("rbd: attempting to teardown at %s", dir)
|
||||
if pathExists, pathErr := volutil.PathExists(dir); pathErr != nil {
|
||||
return fmt.Errorf("Error checking if path exists: %v", pathErr)
|
||||
} else if !pathExists {
|
||||
glog.Warningf("Warning: Unmount skipped because path does not exist: %v", dir)
|
||||
klog.Warningf("Warning: Unmount skipped because path does not exist: %v", dir)
|
||||
return nil
|
||||
}
|
||||
err := diskTearDown(c.manager, *c, dir, c.mounter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(3).Infof("rbd: successfully teardown at %s", dir)
|
||||
klog.V(3).Infof("rbd: successfully teardown at %s", dir)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -971,13 +971,13 @@ func (rbd *rbdDiskUnmapper) TearDownDevice(mapPath, _ string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("rbd: failed to detach disk: %s\nError: %v", mapPath, err)
|
||||
}
|
||||
glog.V(4).Infof("rbd: %q is unmapped, deleting the directory", mapPath)
|
||||
klog.V(4).Infof("rbd: %q is unmapped, deleting the directory", mapPath)
|
||||
|
||||
err = os.RemoveAll(mapPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("rbd: failed to delete the directory: %s\nError: %v", mapPath, err)
|
||||
}
|
||||
glog.V(4).Infof("rbd: successfully detached disk: %s", mapPath)
|
||||
klog.V(4).Infof("rbd: successfully detached disk: %s", mapPath)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ func getVolumeAccessModes(spec *volume.Spec) ([]v1.PersistentVolumeAccessMode, e
|
||||
func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interface) (string, error) {
|
||||
secret, err := volutil.GetSecretForPod(pod, secretName, kubeClient)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
|
||||
klog.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
|
||||
return "", fmt.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
|
||||
}
|
||||
return parseSecretMap(secret)
|
||||
@@ -1086,7 +1086,7 @@ func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interfa
|
||||
func parsePVSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) {
|
||||
secret, err := volutil.GetSecretForPV(namespace, secretName, rbdPluginName, kubeClient)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to get secret from [%q/%q]", namespace, secretName)
|
||||
klog.Errorf("failed to get secret from [%q/%q]", namespace, secretName)
|
||||
return "", fmt.Errorf("failed to get secret from [%q/%q]", namespace, secretName)
|
||||
}
|
||||
return parseSecretMap(secret)
|
||||
|
Reference in New Issue
Block a user