Skip to content

Migrate from klog v1 to klog/v2 and honor stderrthreshold#7363

Open
pierluigilenoci wants to merge 1 commit intoredhat-developer:mainfrom
pierluigilenoci:fix/migrate-klog-v2-honor-stderrthreshold
Open

Migrate from klog v1 to klog/v2 and honor stderrthreshold#7363
pierluigilenoci wants to merge 1 commit intoredhat-developer:mainfrom
pierluigilenoci:fix/migrate-klog-v2-honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown

Summary

  • Replace the deprecated k8s.io/klog (v1) import with k8s.io/klog/v2 across all 91 non-vendor Go source files
  • Fix klog v1→v2 API incompatibility: klog.V(level) returns klog.Verbose instead of bool in v2, updated to use .Enabled() in pkg/podman/podman.go
  • Upgrade k8s.io/klog/v2 from v2.100.1 to v2.140.0
  • Configure legacy_stderr_threshold_behavior=false and stderrthreshold=INFO flags after klog.InitFlags() in cmd/odo/odo.go so that klog properly honors the stderr threshold setting
  • Regenerate vendor/ directory

Motivation

k8s.io/klog v1 is deprecated and unmaintained. The v2 module is the actively maintained replacement.

Additionally, klog v2 introduced a behavioral change where stderrthreshold defaults to ERROR but the legacy behavior silently overrides it. Setting legacy_stderr_threshold_behavior=false ensures the stderrthreshold flag is actually respected.

Ref: kubernetes/klog#212, kubernetes/klog#432

Test plan

  • go build ./... passes (all packages)
  • go mod tidy produces clean dependency graph
  • go mod vendor regenerated successfully
  • Existing CI/CD pipeline should validate no regressions

/cc @feloy @rm3l @kadel

- Replace all `k8s.io/klog` (v1) imports with `k8s.io/klog/v2` across
  91 non-vendor Go source files
- Fix klog v1→v2 API change: `klog.V(level)` now returns `Verbose`
  instead of `bool`, update to use `.Enabled()` in podman.go
- Upgrade `k8s.io/klog/v2` from v2.100.1 to v2.140.0
- Configure `legacy_stderr_threshold_behavior=false` and
  `stderrthreshold=INFO` flags after `klog.InitFlags()` so that klog
  properly honors the stderr threshold setting
- Regenerate vendor/ directory

Ref: kubernetes/klog#212, kubernetes/klog#432
Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@openshift-ci openshift-ci bot requested review from feloy, kadel and rm3l March 26, 2026 23:56
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 02a7869
🔍 Latest deploy log https://app.netlify.com/projects/odo-docusaurus-preview/deploys/69c5c79bb482360008ceb7ad

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. Required by Prow. label Mar 26, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 26, 2026

Hi @pierluigilenoci. Thanks for your PR.

I'm waiting for a redhat-developer member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. Required by Prow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant