Honor stderrthreshold when logtostderr is enabled#794
Conversation
|
Hi @tenzen-y, @terrytangyuan, @alculquicondor -- would you be willing to review? Thank you! |
@pierluigilenoci Thank you for opening this PR, the changes look great! Could you open a PR to update the Go version separately in advance? |
| // Opt into fixed stderrthreshold behavior (kubernetes/klog#212). | ||
| _ = flag.Set("legacy_stderr_threshold_behavior", "false") | ||
| _ = flag.Set("stderrthreshold", "INFO") |
There was a problem hiding this comment.
|
Hi @tenzen-y — thank you for the review and the positive feedback! Two items to address: (1) Move flags to options.go — will move the flag.CommandLine.Set calls into cmd/mpi-operator/app/options/options.go as requested. (2) Go 1.26 update — understood, the Validate CI failure is because controller-runtime/tools/setup-envtest now requires Go >= 1.26.0. I will open a separate PR to bump the Go version first, then rebase this one on top. Will update shortly. Thank you! |
|
Hi @tenzen-y — thank you for the review feedback! I saw the note about updating the Go version. Just to confirm: the I'm happy to address the Go version update as part of this PR or in a separate one — whichever you prefer. Could you let me know how you'd like to proceed? Thank you! |
Thank you for opening that! I left a small comment for the Go version PR, could you address that? After that we can move PRs move forward. |
|
@pierluigilenoci, could you rebase this PR on top of the master branch? Because we merged your Go version updating PR to the master branch. |
Opt into the fixed klog behavior by setting legacy_stderr_threshold_behavior=false after klog.InitFlags(). Ref: kubernetes/klog#212, kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
Move klog.InitFlags() and stderrthreshold flag settings from cmd/mpi-operator/main.go to cmd/mpi-operator/app/options/options.go as requested in code review. Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
86808ea to
5dc78bc
Compare
tenzen-y
left a comment
There was a problem hiding this comment.
Awesome, thank you!
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tenzen-y 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 |
Summary
Opt into the new klog behavior so that
-stderrthresholdis honored even when-logtostderr=true(the default). Setstderrthreshold=INFOto preserve backward compatibility.Background
When
-logtostderr=true,-stderrthresholdwas ignored -- all logs went to stderr. Fixed in kubernetes/klog#432 (v2.140.0+), but projects must opt in.Changes
flag.Set("legacy_stderr_threshold_behavior", "false")andflag.Set("stderrthreshold", "INFO")afterklog.InitFlags()incmd/mpi-operator/main.gok8s.io/klog/v2from v2.130.1 to v2.140.0References