mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Migrate cmd/kubelet, image, cadvisor and cri to structured logging
This commit is contained in:
		@@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
	}()
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ func init() {
 | 
			
		||||
			f.DefValue = defaultValue
 | 
			
		||||
			f.Value.Set(defaultValue)
 | 
			
		||||
		} else {
 | 
			
		||||
			klog.Errorf("Expected cAdvisor flag %q not found", name)
 | 
			
		||||
			klog.ErrorS(nil, "Expected cAdvisor flag not found", "flag", name)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -186,7 +186,7 @@ func (cc *cadvisorClient) getFsInfo(label string) (cadvisorapiv2.FsInfo, error)
 | 
			
		||||
	}
 | 
			
		||||
	// TODO(vmarmol): Handle this better when a label has more than one image filesystem.
 | 
			
		||||
	if len(res) > 1 {
 | 
			
		||||
		klog.Warningf("More than one filesystem labeled %q: %#v. Only using the first one", label, res)
 | 
			
		||||
		klog.InfoS("More than one filesystem labeled. Only using the first one", "label", label, "fileSystem", res)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return res[0], nil
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ func parseEndpointWithFallbackProtocol(endpoint string, fallbackProtocol string)
 | 
			
		||||
		fallbackEndpoint := fallbackProtocol + "://" + endpoint
 | 
			
		||||
		protocol, addr, err = parseEndpoint(fallbackEndpoint)
 | 
			
		||||
		if err == nil {
 | 
			
		||||
			klog.Warningf("Using %q as endpoint is deprecated, please consider using full url format %q.", endpoint, fallbackEndpoint)
 | 
			
		||||
			klog.InfoS("Using this format as endpoint is deprecated, please consider using full url format.", "deprecatedFormat", endpoint, "fullURLFormat", fallbackEndpoint)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,7 @@ func (m *imageManager) EnsureImageExists(pod *v1.Pod, container *v1.Container, p
 | 
			
		||||
	logPrefix := fmt.Sprintf("%s/%s/%s", pod.Namespace, pod.Name, container.Image)
 | 
			
		||||
	ref, err := kubecontainer.GenerateContainerRef(pod, container)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		klog.Errorf("Couldn't make a ref to pod %v, container %v: '%v'", pod.Name, container.Name, err)
 | 
			
		||||
		klog.ErrorS(err, "Couldn't make a ref to pod", "pod", klog.KObj(pod), "containerName", container.Name)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If the image contains no tag or digest, a default tag should be applied.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user