Skip to content

fix: honor stderrthreshold on Windows entrypoint#1267

Merged
hakman merged 1 commit intokubernetes:masterfrom
pierluigilenoci:fix/honor-stderrthreshold-windows
Apr 23, 2026
Merged

fix: honor stderrthreshold on Windows entrypoint#1267
hakman merged 1 commit intokubernetes:masterfrom
pierluigilenoci:fix/honor-stderrthreshold-windows

Conversation

@pierluigilenoci
Copy link
Copy Markdown
Member

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

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>
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 21, 2026
@hakman
Copy link
Copy Markdown
Member

hakman commented Apr 22, 2026

/override lint

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@hakman: Overrode contexts on behalf of hakman: lint

Details

In response to this:

/override lint

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.

@hakman
Copy link
Copy Markdown
Member

hakman commented Apr 22, 2026

Thanks @pierluigilenoci, appreciate the PR.
/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 Apr 22, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[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

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 Apr 22, 2026
@hakman
Copy link
Copy Markdown
Member

hakman commented Apr 22, 2026

/override lint

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@hakman: Overrode contexts on behalf of hakman: lint

Details

In response to this:

/override lint

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.

@hakman hakman merged commit 0c927ad into kubernetes:master Apr 23, 2026
14 of 16 checks passed
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants