mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-02-21 22:57:15 +00:00
fix(kubelet): convert V().Error() to V().Info() for verbosity-aware logging
This PR fixes incorrect usage of `logger.V(N).Error()` in the kubelet
package. The go-logr package design causes `Error()` calls to bypass
verbosity level checks entirely, meaning these logs are always printed
regardless of the configured verbosity level.
Note: In release-1.33, only pleg/generic.go uses contextual logging
(logger.V().Error). All other files use klog.V().ErrorS() which properly
respects verbosity levels, so they are NOT changed in this cherry-pick.
Files modified (1 file, 1 instance):
- pkg/kubelet/pleg/generic.go
Conversion pattern applied:
- g.logger.V(N).Error(err, "msg", ...) → g.logger.V(N).Info("msg", ..., "err", err)
Fixes: https://github.com/kubernetes/kubernetes/issues/136027
Cherry-pick of: https://github.com/kubernetes/kubernetes/pull/136028
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
This commit is contained in:
@@ -299,7 +299,7 @@ func (g *GenericPLEG) Relist() {
|
||||
status, updated, err := g.updateCache(ctx, pod, pid)
|
||||
if err != nil {
|
||||
// Rely on updateCache calling GetPodStatus to log the actual error.
|
||||
g.logger.V(4).Error(err, "PLEG: Ignoring events for pod", "pod", klog.KRef(pod.Namespace, pod.Name))
|
||||
g.logger.V(4).Info("PLEG: Ignoring events for pod", "pod", klog.KRef(pod.Namespace, pod.Name), "err", err)
|
||||
|
||||
// make sure we try to reinspect the pod during the next relisting
|
||||
needsReinspection[pid] = pod
|
||||
|
||||
Reference in New Issue
Block a user