fix: honor klog -stderrthreshold even when -logtostderr is true#168
fix: honor klog -stderrthreshold even when -logtostderr is true#168pierluigilenoci wants to merge 5 commits into
Conversation
klog v2 defaults -logtostderr to true, which silently ignores -stderrthreshold — all log levels go to stderr unconditionally. This has been an open issue since 2020 (kubernetes/klog#212). klog v2.140.0 introduced a fix behind an opt-in flag (legacy_stderr_threshold_behavior). This commit bumps klog to v2.140.0 and enables the fix in both entry points so that -stderrthreshold is honored, while preserving the current default behavior (stderrthreshold=INFO means all logs still go to stderr unless the user overrides it on the command line). Ref: kubernetes/klog#212 Ref: kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #168 +/- ##
=========================================
- Coverage 10.51% 9.89% -0.63%
=========================================
Files 49 49
Lines 7029 6501 -528
=========================================
- Hits 739 643 -96
+ Misses 6238 5806 -432
Partials 52 52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Cover the new klog flag overrides (legacy_stderr_threshold_behavior and stderrthreshold) introduced in the previous commit to satisfy the codecov patch coverage threshold (70%). Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com> Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
|
Added a unit test for Regarding the |
|
@yue9944882 @Somefive — friendly ping, could one of you review this when you get a chance? The |
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
|
Hi — friendly follow-up. CI is green, merge state is clean, and all checks are passing. Would you be able to review when you get a chance? Thank you! |
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
|
Hi @yue9944882 @Somefive — friendly ping on this PR. All CI checks are green and the branch is up-to-date. Would you be willing to take a look when you have a chance? Happy to address any feedback. Thank you! |
What changed
klog v2 defaults
-logtostderrtotrue, which silently ignores-stderrthreshold— all log levels go to stderr unconditionally. This has been an open issue since 2020.klog v2.140.0 introduced a fix behind an opt-in flag (
legacy_stderr_threshold_behavior). This PR bumps klog to v2.140.0 and enables the fix in both entry points (cmd/addon-manager/main.goandpkg/config/args_log.go) so that-stderrthresholdis honored, while preserving the current default behavior.References
Summary by cubic
Honor -stderrthreshold when -logtostderr=true by enabling klog’s new behavior. Default stderr level stays at INFO unless overridden.
Bug Fixes
Dependencies
k8s.io/klog/v2tov2.140.0.Written for commit 1e01bde. Summary will update on new commits.