Migrate pkg/kubelet/util to structured logging

Part of https://github.com/kubernetes/kubernetes/issues/98976
This commit is contained in:
Navid Shaikh 2021-03-05 12:15:18 +05:30
parent 59012258ca
commit 1f22a173d9
3 changed files with 3 additions and 3 deletions

View File

@ -208,7 +208,7 @@ func (c *objectCache) Get(namespace, name string) (runtime.Object, error) {
// we limit ourselves to just quickly stop the reflector here.
if c.isImmutable(object) {
if item.stop() {
klog.V(4).Infof("Stopped watching for changes of %q/%q - object is immutable", namespace, name)
klog.V(4).InfoS("Stopped watching for changes - object is immutable", "obj", klog.KRef(namespace, name))
}
}
return object, nil

View File

@ -46,7 +46,7 @@ func SetNodeOwnerFunc(c clientset.Interface, nodeName string) func(lease *coordi
},
}
} else {
klog.Errorf("failed to get node %q when trying to set owner ref to the node lease: %v", nodeName, err)
klog.ErrorS(err, "Failed to get node when trying to set owner ref to the node lease", "node", klog.KRef("", nodeName))
return err
}
}

View File

@ -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 endpoint is deprecated, please consider using full URL format", "endpoint", endpoint, "URL", fallbackEndpoint)
}
}
return