Migrate to k8s.io/klog from glog.
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
@@ -28,7 +28,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
clientset "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned"
|
||||
@@ -191,7 +191,7 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
|
||||
r.lock.Lock()
|
||||
defer r.lock.Unlock()
|
||||
|
||||
glog.V(4).Infof("reactor got operation %q on %q", action.GetVerb(), action.GetResource())
|
||||
klog.V(4).Infof("reactor got operation %q on %q", action.GetVerb(), action.GetResource())
|
||||
|
||||
// Inject error when requested
|
||||
err = r.injectReactError(action)
|
||||
@@ -215,7 +215,7 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
|
||||
r.contents[content.Name] = content
|
||||
r.changedObjects = append(r.changedObjects, content)
|
||||
r.changedSinceLastSync++
|
||||
glog.V(5).Infof("created content %s", content.Name)
|
||||
klog.V(5).Infof("created content %s", content.Name)
|
||||
return true, content, nil
|
||||
|
||||
case action.Matches("update", "volumesnapshotcontents"):
|
||||
@@ -241,7 +241,7 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
|
||||
r.contents[content.Name] = content
|
||||
r.changedObjects = append(r.changedObjects, content)
|
||||
r.changedSinceLastSync++
|
||||
glog.V(4).Infof("saved updated content %s", content.Name)
|
||||
klog.V(4).Infof("saved updated content %s", content.Name)
|
||||
return true, content, nil
|
||||
|
||||
case action.Matches("update", "volumesnapshots"):
|
||||
@@ -267,32 +267,32 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
|
||||
r.snapshots[snapshot.Name] = snapshot
|
||||
r.changedObjects = append(r.changedObjects, snapshot)
|
||||
r.changedSinceLastSync++
|
||||
glog.V(4).Infof("saved updated snapshot %s", snapshot.Name)
|
||||
klog.V(4).Infof("saved updated snapshot %s", snapshot.Name)
|
||||
return true, snapshot, nil
|
||||
|
||||
case action.Matches("get", "volumesnapshotcontents"):
|
||||
name := action.(core.GetAction).GetName()
|
||||
content, found := r.contents[name]
|
||||
if found {
|
||||
glog.V(4).Infof("GetVolume: found %s", content.Name)
|
||||
klog.V(4).Infof("GetVolume: found %s", content.Name)
|
||||
return true, content, nil
|
||||
}
|
||||
glog.V(4).Infof("GetVolume: content %s not found", name)
|
||||
klog.V(4).Infof("GetVolume: content %s not found", name)
|
||||
return true, nil, fmt.Errorf("cannot find content %s", name)
|
||||
|
||||
case action.Matches("get", "volumesnapshots"):
|
||||
name := action.(core.GetAction).GetName()
|
||||
snapshot, found := r.snapshots[name]
|
||||
if found {
|
||||
glog.V(4).Infof("GetSnapshot: found %s", snapshot.Name)
|
||||
klog.V(4).Infof("GetSnapshot: found %s", snapshot.Name)
|
||||
return true, snapshot, nil
|
||||
}
|
||||
glog.V(4).Infof("GetSnapshot: content %s not found", name)
|
||||
klog.V(4).Infof("GetSnapshot: content %s not found", name)
|
||||
return true, nil, fmt.Errorf("cannot find snapshot %s", name)
|
||||
|
||||
case action.Matches("delete", "volumesnapshotcontents"):
|
||||
name := action.(core.DeleteAction).GetName()
|
||||
glog.V(4).Infof("deleted content %s", name)
|
||||
klog.V(4).Infof("deleted content %s", name)
|
||||
_, found := r.contents[name]
|
||||
if found {
|
||||
delete(r.contents, name)
|
||||
@@ -303,7 +303,7 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
|
||||
|
||||
case action.Matches("delete", "volumesnapshots"):
|
||||
name := action.(core.DeleteAction).GetName()
|
||||
glog.V(4).Infof("deleted snapshot %s", name)
|
||||
klog.V(4).Infof("deleted snapshot %s", name)
|
||||
_, found := r.contents[name]
|
||||
if found {
|
||||
delete(r.snapshots, name)
|
||||
@@ -316,40 +316,40 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
|
||||
name := action.(core.GetAction).GetName()
|
||||
volume, found := r.volumes[name]
|
||||
if found {
|
||||
glog.V(4).Infof("GetVolume: found %s", volume.Name)
|
||||
klog.V(4).Infof("GetVolume: found %s", volume.Name)
|
||||
return true, volume, nil
|
||||
}
|
||||
glog.V(4).Infof("GetVolume: volume %s not found", name)
|
||||
klog.V(4).Infof("GetVolume: volume %s not found", name)
|
||||
return true, nil, fmt.Errorf("cannot find volume %s", name)
|
||||
|
||||
case action.Matches("get", "persistentvolumeclaims"):
|
||||
name := action.(core.GetAction).GetName()
|
||||
claim, found := r.claims[name]
|
||||
if found {
|
||||
glog.V(4).Infof("GetClaim: found %s", claim.Name)
|
||||
klog.V(4).Infof("GetClaim: found %s", claim.Name)
|
||||
return true, claim, nil
|
||||
}
|
||||
glog.V(4).Infof("GetClaim: claim %s not found", name)
|
||||
klog.V(4).Infof("GetClaim: claim %s not found", name)
|
||||
return true, nil, fmt.Errorf("cannot find claim %s", name)
|
||||
|
||||
case action.Matches("get", "storageclasses"):
|
||||
name := action.(core.GetAction).GetName()
|
||||
storageClass, found := r.storageClasses[name]
|
||||
if found {
|
||||
glog.V(4).Infof("GetStorageClass: found %s", storageClass.Name)
|
||||
klog.V(4).Infof("GetStorageClass: found %s", storageClass.Name)
|
||||
return true, storageClass, nil
|
||||
}
|
||||
glog.V(4).Infof("GetStorageClass: storageClass %s not found", name)
|
||||
klog.V(4).Infof("GetStorageClass: storageClass %s not found", name)
|
||||
return true, nil, fmt.Errorf("cannot find storageClass %s", name)
|
||||
|
||||
case action.Matches("get", "secrets"):
|
||||
name := action.(core.GetAction).GetName()
|
||||
secret, found := r.secrets[name]
|
||||
if found {
|
||||
glog.V(4).Infof("GetSecret: found %s", secret.Name)
|
||||
klog.V(4).Infof("GetSecret: found %s", secret.Name)
|
||||
return true, secret, nil
|
||||
}
|
||||
glog.V(4).Infof("GetSecret: secret %s not found", name)
|
||||
klog.V(4).Infof("GetSecret: secret %s not found", name)
|
||||
return true, nil, fmt.Errorf("cannot find secret %s", name)
|
||||
|
||||
}
|
||||
@@ -366,11 +366,11 @@ func (r *snapshotReactor) injectReactError(action core.Action) error {
|
||||
}
|
||||
|
||||
for i, expected := range r.errors {
|
||||
glog.V(4).Infof("trying to match %q %q with %q %q", expected.verb, expected.resource, action.GetVerb(), action.GetResource())
|
||||
klog.V(4).Infof("trying to match %q %q with %q %q", expected.verb, expected.resource, action.GetVerb(), action.GetResource())
|
||||
if action.Matches(expected.verb, expected.resource) {
|
||||
// That's the action we're waiting for, remove it from injectedErrors
|
||||
r.errors = append(r.errors[:i], r.errors[i+1:]...)
|
||||
glog.V(4).Infof("reactor found matching error at index %d: %q %q, returning %v", i, expected.verb, expected.resource, expected.error)
|
||||
klog.V(4).Infof("reactor found matching error at index %d: %q %q, returning %v", i, expected.verb, expected.resource, expected.error)
|
||||
return expected.error
|
||||
}
|
||||
}
|
||||
@@ -477,14 +477,14 @@ func checkEvents(t *testing.T, expectedEvents []string, ctrl *csiSnapshotControl
|
||||
select {
|
||||
case event, ok := <-fakeRecorder.Events:
|
||||
if ok {
|
||||
glog.V(5).Infof("event recorder got event %s", event)
|
||||
klog.V(5).Infof("event recorder got event %s", event)
|
||||
gotEvents = append(gotEvents, event)
|
||||
} else {
|
||||
glog.V(5).Infof("event recorder finished")
|
||||
klog.V(5).Infof("event recorder finished")
|
||||
finished = true
|
||||
}
|
||||
case _, _ = <-timer.C:
|
||||
glog.V(5).Infof("event recorder timeout")
|
||||
klog.V(5).Infof("event recorder timeout")
|
||||
finished = true
|
||||
}
|
||||
}
|
||||
@@ -524,10 +524,10 @@ func (r *snapshotReactor) popChange() interface{} {
|
||||
switch obj.(type) {
|
||||
case *crdv1.VolumeSnapshotContent:
|
||||
vol, _ := obj.(*crdv1.VolumeSnapshotContent)
|
||||
glog.V(4).Infof("reactor queue: %s", vol.Name)
|
||||
klog.V(4).Infof("reactor queue: %s", vol.Name)
|
||||
case *crdv1.VolumeSnapshot:
|
||||
snapshot, _ := obj.(*crdv1.VolumeSnapshot)
|
||||
glog.V(4).Infof("reactor queue: %s", snapshot.Name)
|
||||
klog.V(4).Infof("reactor queue: %s", snapshot.Name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -981,7 +981,7 @@ func wrapTestWithInjectedOperation(toWrap testCall, injectBeforeOperation func(c
|
||||
|
||||
return func(ctrl *csiSnapshotController, reactor *snapshotReactor, test controllerTest) error {
|
||||
// Inject a hook before async operation starts
|
||||
glog.V(4).Infof("reactor:injecting call")
|
||||
klog.V(4).Infof("reactor:injecting call")
|
||||
injectBeforeOperation(ctrl, reactor)
|
||||
|
||||
// Run the tested function (typically syncSnapshot/syncContent) in a
|
||||
@@ -1028,7 +1028,7 @@ func evaluateTestResults(ctrl *csiSnapshotController, reactor *snapshotReactor,
|
||||
func runSyncTests(t *testing.T, tests []controllerTest, snapshotClasses []*crdv1.VolumeSnapshotClass) {
|
||||
snapshotscheme.AddToScheme(scheme.Scheme)
|
||||
for _, test := range tests {
|
||||
glog.V(4).Infof("starting test %q", test.name)
|
||||
klog.V(4).Infof("starting test %q", test.name)
|
||||
|
||||
// Initialize the controller
|
||||
kubeClient := &kubefake.Clientset{}
|
||||
|
Reference in New Issue
Block a user