Skip to content

Honor stderrthreshold when logtostderr is enabled#1822

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
pierluigilenoci:fix/honor-stderrthreshold
Mar 30, 2026
Merged

Honor stderrthreshold when logtostderr is enabled#1822
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown
Contributor

Summary

  • Update k8s.io/klog/v2 to v2.140.0 which includes the fix for kubernetes/klog#212
  • Opt into the new klog behavior by setting -legacy_stderr_threshold_behavior=false
  • Set -stderrthreshold=INFO to preserve backward-compatible behavior
  • Users can now override -stderrthreshold to WARNING or ERROR to reduce stderr noise

Fixes #128

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

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2026
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 23, 2026
Update k8s.io/klog/v2 from v2.130.1 to v2.140.0 and opt into the new
behavior where -stderrthreshold is honored even when -logtostderr=true.

Previously, with the default -logtostderr=true, the -stderrthreshold
flag was completely ignored and all log levels went to stderr. klog
v2.140.0 (kubernetes/klog#432) added a new opt-in flag
-legacy_stderr_threshold_behavior that, when set to false, makes
-stderrthreshold work as expected.

Set -stderrthreshold=INFO to preserve backward-compatible behavior.
Users can now override it to WARNING or ERROR to reduce stderr noise.

Fixes kubernetes-sigs#128

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@pierluigilenoci pierluigilenoci force-pushed the fix/honor-stderrthreshold branch from 41b1587 to 8161ba0 Compare March 23, 2026 22:48
@pierluigilenoci pierluigilenoci marked this pull request as ready for review March 23, 2026 22:55
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2026
@pierluigilenoci
Copy link
Copy Markdown
Contributor Author

/test all

@pierluigilenoci
Copy link
Copy Markdown
Contributor Author

cc @leakingtapan @mskanth972 — would you be able to review this when you get a chance? This opts into the klog fix for kubernetes/klog#212 so that -stderrthreshold is honored even when -logtostderr=true.

@pierluigilenoci
Copy link
Copy Markdown
Contributor Author

Gentle ping @leakingtapan @mskanth972 — would you be able to review when you get a chance? This is a one-line fix for kubernetes/klog#432. Thank you!

@DavidXU12345
Copy link
Copy Markdown
Contributor

I did e2e tests from my end and verified that if we set stderrthreshold to WARNING,

  • Before the fix, INFO level logs still get printed out
  • After the fix, all INFO level logs will not be printed after the fix.
kubectl patch ds efs-csi-node -n kube-system --type=json -p='[
  {"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--stderrthreshold=WARNING"}
]'
daemonset.apps/efs-csi-node patched

@DavidXU12345
Copy link
Copy Markdown
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 30, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DavidXU12345, pierluigilenoci

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2026
@k8s-ci-robot k8s-ci-robot merged commit dd6c88a into kubernetes-sigs:master Mar 30, 2026
9 checks passed
@pierluigilenoci pierluigilenoci deleted the fix/honor-stderrthreshold branch March 30, 2026 22:05
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Livenessprobe ignores stderrthreshold flag

3 participants