fix: honor stderrthreshold on Windows entrypoint#1267
fix: honor stderrthreshold on Windows entrypoint#1267hakman merged 1 commit intokubernetes:masterfrom
Conversation
The Unix entrypoint already sets legacy_stderr_threshold_behavior=false and stderrthreshold=INFO, but the Windows entrypoint was missed. klog v2 defaults -logtostderr to true. When active, -stderrthreshold is silently ignored — all log levels are unconditionally sent to stderr. Setting legacy_stderr_threshold_behavior=false enables the fix so that -stderrthreshold is honored even when -logtostderr=true. Ref: kubernetes/klog#212, kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com> Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
|
/override lint |
|
@hakman: Overrode contexts on behalf of hakman: lint DetailsIn response to this:
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. |
|
Thanks @pierluigilenoci, appreciate the PR. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hakman, pierluigilenoci The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/override lint |
|
@hakman: Overrode contexts on behalf of hakman: lint DetailsIn response to this:
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. |
What this PR does
Adds the missing `legacy_stderr_threshold_behavior=false` and `stderrthreshold=INFO` flag settings to the Windows entrypoint, matching what was already done for Unix.
Problem
The Unix entrypoint (`node_problem_detector_unix.go`) already opts into the fixed klog `stderrthreshold` behavior, but the Windows entrypoint (`node_problem_detector_windows.go`) was missed. On Windows, `-stderrthreshold` is still silently ignored when `-logtostderr=true`.
Fix
Two `klogFlags.Set()` calls are added immediately after `klog.InitFlags(klogFlags)`, mirroring the existing pattern in the Unix file:
```go
_ = klogFlags.Set("legacy_stderr_threshold_behavior", "false")
_ = klogFlags.Set("stderrthreshold", "INFO")
```
This preserves the current default behavior (all logs go to stderr) while allowing users to override `-stderrthreshold` at runtime.
References