Skip to content

logcheck: detect logger.V().Error#32

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
pohly:v-error-check
Jan 13, 2026
Merged

logcheck: detect logger.V().Error#32
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
pohly:v-error-check

Conversation

@pohly

@pohly pohly commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

This might be the result of a literal klog.V().ErrorS migration. But the semantic is different, which is worth calling out in the linter because it's not a compile error.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 5, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If logtools contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 5, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in SIG Instrumentation Jan 5, 2026
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 5, 2026
@pohly

pohly commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

/hold

Needs to be checked in Kubernetes.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 5, 2026
@pohly

pohly commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

/hold cancel

Works as intended:

ERROR: pkg/controller/garbagecollector/garbagecollector.go:363:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(5).Error(err, "error syncing item", "item", n.identity)
ERROR: 			       ^
ERROR: pkg/controller/garbagecollector/graph_builder.go:225:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(4).Error(err, "unable to use a shared informer", "resource", resource, "kind", kind)
ERROR: 		       ^
ERROR: pkg/controller/resourcequota/resource_quota_monitor.go:178:9: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 	logger.V(4).Error(err, "QuotaMonitor unable to use a shared informer", "resource", resource.String())
ERROR: 	       ^
ERROR: pkg/controller/storageversionmigrator/storageversionmigrator.go:227:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(4).Error(err, "resource does not exist in our rest mapper", "gvr", gvr.String())
ERROR: 		       ^
ERROR: pkg/controller/storageversionmigrator/storageversionmigrator.go:244:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(4).Error(errMonitor, "resource does not exist in GC", "gvr", gvr.String())
ERROR: 		       ^
ERROR: pkg/controller/storageversionmigrator/storageversionmigrator.go:311:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(4).Error(err, "Unable to compare the resource version of the resource", "namespace", accessor.GetNamespace(), "name", accessor.GetName(), "gvr", gvr.String(), "accessorRV", accessor.GetResourceVersion(), "listResourceVersion", listResourceVersion, "error", err.Error())
ERROR: 			       ^
ERROR: pkg/controller/storageversionmigrator/storageversionmigrator.go:361:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(4).Error(errPatch, "Failed to migrate the resource", "namespace", accessor.GetNamespace(), "name", accessor.GetName(), "gvr", gvr.String(), "reason", apierrors.ReasonForError(errPatch))
ERROR: 			       ^
ERROR: pkg/controller/volume/selinuxwarning/selinux_warning_controller.go:476:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(4).Error(err, "failed to get SELinux label", "pod", klog.KObj(pod), "volume", mount)
ERROR: 			       ^
ERROR: pkg/controller/volume/selinuxwarning/selinux_warning_controller.go:539:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(2).Error(err, "failed to get first pod for event", "pod", conflict.Pod)
ERROR: 			       ^
ERROR: pkg/kubelet/allocation/allocation_manager.go:576:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(3).Error(err, "Failed to delete pod allocation", "podUID", uid)
ERROR: 		       ^
ERROR: pkg/kubelet/cm/devicemanager/plugin/v1beta1/client.go:107:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(2).Error(err, "Failed to close grpc connection", "resource", c.Resource())
ERROR: 			       ^
ERROR: pkg/kubelet/cm/dra/plugin/dra_plugin_manager.go:398:13: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 					logger.V(3).Error(err, "Failed to establish WatchResources stream, will retry")
ERROR: 					       ^
ERROR: pkg/kubelet/kuberuntime/kuberuntime_container_linux.go:430:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(5).Error(fmt.Errorf("failed to parse /proc/self/cgroup: %w", err), warn)
ERROR: 			       ^
ERROR: pkg/kubelet/kuberuntime/kuberuntime_container_linux.go:441:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(5).Error(err, warn)
ERROR: 			       ^
ERROR: pkg/kubelet/lifecycle/handlers.go:85:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(1).Error(err, "Exec lifecycle hook for Container in Pod failed", "execCommand", handler.Exec.Command, "containerName", container.Name, "pod", klog.KObj(pod), "message", string(output))
ERROR: 			       ^
ERROR: pkg/kubelet/lifecycle/handlers.go:93:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(1).Error(err, "HTTP lifecycle hook for Container in Pod failed", "path", handler.HTTPGet.Path, "containerName", container.Name, "pod", klog.KObj(pod))
ERROR: 			       ^
ERROR: pkg/kubelet/lifecycle/handlers.go:101:11: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			logger.V(1).Error(err, "Sleep lifecycle hook for Container in Pod failed", "sleepSeconds", handler.Sleep.Seconds, "containerName", container.Name, "pod", klog.KObj(pod))
ERROR: 			       ^
ERROR: pkg/kubelet/lifecycle/handlers.go:152:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(1).Error(err, "HTTPS request to lifecycle hook got HTTP response, retrying with HTTP.", "pod", klog.KObj(pod), "host", req.URL.Host)
ERROR: 		       ^
ERROR: pkg/kubelet/metrics/collectors/cri_metrics.go:110:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(5).Error(err, "Descriptor not present in pre-populated list of descriptors", "name", m.Name)
ERROR: 		       ^
ERROR: pkg/kubelet/pleg/generic.go:300:13: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 			g.logger.V(4).Error(err, "PLEG: Ignoring events for pod", "pod", klog.KRef(pod.Namespace, pod.Name))
ERROR: 			         ^
ERROR: pkg/kubelet/prober/prober.go:106:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(1).Error(err, "Probe errored", "probeType", probeType, "pod", klog.KObj(pod), "podUID", pod.UID, "containerName", container.Name, "probeResult", result)
ERROR: 		       ^
ERROR: pkg/kubelet/prober/prober_manager.go:197:12: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 				logger.V(8).Error(nil, "Startup probe already exists for container",
ERROR: 				       ^
ERROR: pkg/kubelet/prober/prober_manager.go:209:12: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 				logger.V(8).Error(nil, "Readiness probe already exists for container",
ERROR: 				       ^
ERROR: pkg/kubelet/prober/prober_manager.go:221:12: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 				logger.V(8).Error(nil, "Liveness probe already exists for container",
ERROR: 				       ^
ERROR: pkg/kubelet/stats/cri_stats_provider.go:168:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(5).Error(err,
ERROR: 		       ^
ERROR: pkg/kubelet/stats/helper.go:502:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(6).Error(err, "Unable to fetch pod log stats", "pod", klog.KRef(podNs, podName))
ERROR: 		       ^
ERROR: pkg/kubelet/stats/helper.go:510:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(6).Error(err, "Unable to fetch pod etc hosts stats", "pod", klog.KRef(podNs, podName))
ERROR: 		       ^
ERROR: pkg/kubelet/volumemanager/cache/desired_state_of_world.go:673:9: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 	logger.V(4).Error(err, "Please report this error in https://github.com/kubernetes/enhancements/issues/1710, together with full Pod yaml file")
ERROR: 	       ^
ERROR: pkg/kubelet/volumemanager/cache/desired_state_of_world.go:688:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(4).Error(err, "failed to get CSI driver name from volume spec")
ERROR: 		       ^
ERROR: pkg/kubelet/volumemanager/reconciler/reconstruct.go:188:10: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		logger.V(4).Error(fetchErr, "Failed to get Node status to reconstruct device paths")
ERROR: 		       ^
ERROR: staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go:418:25: V().Error ignores the verbosity and always logs. Use only Error if that is desired, otherwise V().Info(..., "err", err). (logcheck)
ERROR: 		klog.FromContext(ctx).V(1).Error(err, "failed to authorize")
ERROR: 		                      ^
31 issues:
* logcheck: 31

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 5, 2026
This might be the result of a literal `klog.V().ErrorS` migration.
But the semantic is different, which is worth calling out in the linter because
it's not a compile error.
thc1006 added a commit to thc1006/kubernetes that referenced this pull request Jan 5, 2026
…ogging

The go-logr package ignores verbosity levels for Error() calls, causing
logs to always print regardless of -v flag settings. This change converts
V().Error() calls to V().Info() with the error as a key-value pair,
ensuring verbosity settings are respected.

Affected components:
- prober/prober_manager.go (3 instances) - V(8).Error(nil, ...)
- prober/prober.go (1 instance) - V(1).Error(err, ...)
- lifecycle/handlers.go (4 instances) - V(1).Error(err, ...)
- kuberuntime/kuberuntime_container_linux.go (2 instances) - V(5).Error(...)
- pleg/generic.go (1 instance) - V(4).Error(err, ...)
- allocation/allocation_manager.go (1 instance) - V(3).Error(err, ...)
- stats/helper.go (2 instances) - V(6).Error(err, ...)
- stats/cri_stats_provider.go (1 instance) - V(5).Error(err, ...)
- cm/devicemanager/plugin/v1beta1/client.go (1 instance) - V(2).Error(err, ...)
- cm/dra/plugin/dra_plugin_manager.go (1 instance) - V(3).Error(err, ...)
- metrics/collectors/cri_metrics.go (1 instance) - V(5).Error(err, ...)

This addresses the kubelet portion of the V().Error() misuse. Changes to
pkg/kubelet/volumemanager/ are submitted separately due to different
OWNERS (sig-storage).

Fixes kubernetes#135996
Ref kubernetes#136027
Ref kubernetes-sigs/logtools#32

Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
@pohly

pohly commented Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

/assign @thockin

@thockin thockin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 13, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pohly, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 84220d7 into kubernetes-sigs:main Jan 13, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in SIG Instrumentation Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants