Migrate cmd/kubelet, image, cadvisor and cri to structured logging

This commit is contained in:
afrouz
2021-03-09 12:29:32 +03:30
parent eeccc9f9c0
commit 8f2e927b4a
5 changed files with 11 additions and 11 deletions

View File

@@ -43,16 +43,16 @@ func appendPluginBasedOnFeatureFlags(plugins []volume.VolumePlugin, inTreePlugin
migrationComplete, err := csimigration.CheckMigrationFeatureFlags(featureGate, pluginInfo.pluginMigrationFeature,
pluginInfo.pluginMigrationCompleteFeature, pluginInfo.pluginUnregisterFeature)
if err != nil {
klog.Warningf("Unexpected CSI Migration Feature Flags combination detected: %v. CSI Migration may not take effect", err)
klog.InfoS("Unexpected CSI Migration Feature Flags combination detected, CSI Migration may not take effect", "err", err)
// TODO: fail and return here once alpha only tests can set the feature flags for a plugin correctly
}
// TODO: This can be removed after feature flag CSIMigrationvSphereComplete is removed.
if migrationComplete {
klog.Infof("Skip registration of plugin %s since migration is complete", inTreePluginName)
klog.InfoS("Skipped registration of plugin since migration is completed", "pluginName", inTreePluginName)
return plugins, nil
}
if featureGate.Enabled(pluginInfo.pluginUnregisterFeature) {
klog.Infof("Skip registration of plugin %s since feature flag %v is enabled", inTreePluginName, pluginInfo.pluginUnregisterFeature)
klog.Infof("Skipped registration of plugin since feature flag is enabled", "pluginName", inTreePluginName, "featureFlag", pluginInfo.pluginUnregisterFeature)
return plugins, nil
}

View File

@@ -24,19 +24,19 @@ import (
func watchForLockfileContention(path string, done chan struct{}) error {
watcher, err := inotify.NewWatcher()
if err != nil {
klog.Errorf("unable to create watcher for lockfile: %v", err)
klog.ErrorS(err, "Unable to create watcher for lockfile")
return err
}
if err = watcher.AddWatch(path, inotify.InOpen|inotify.InDeleteSelf); err != nil {
klog.Errorf("unable to watch lockfile: %v", err)
klog.ErrorS(err, "Unable to watch lockfile")
return err
}
go func() {
select {
case ev := <-watcher.Event:
klog.Infof("inotify event: %v", ev)
klog.InfoS("inotify event", "event", ev)
case err = <-watcher.Error:
klog.Errorf("inotify watcher error: %v", err)
klog.ErrorS(err, "inotify watcher error")
}
close(done)
}()