From bc3c913ff04d30bbaca462e20d2788dbca6ffd6f Mon Sep 17 00:00:00 2001 From: Pierluigi Lenoci Date: Wed, 22 Apr 2026 12:08:41 +0200 Subject: [PATCH] fix: honor -stderrthreshold when -logtostderr is true (default) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit klog v2 defaults -logtostderr to true, which silently ignores the -stderrthreshold flag — all log levels are unconditionally sent to stderr. Bump klog to v2.140.0 and opt into the fixed behavior in the web-console-validator binary by setting legacy_stderr_threshold_behavior=false and stderrthreshold=INFO. This preserves current output while letting users override via CLI flags. Ref: kubernetes/klog#212, kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci --- cmd/web-console-validator/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/web-console-validator/main.go b/cmd/web-console-validator/main.go index 15ffac50a..95962c2aa 100644 --- a/cmd/web-console-validator/main.go +++ b/cmd/web-console-validator/main.go @@ -45,6 +45,11 @@ func init() { func main() { // Using the same type of logger as in the controller-manager. klog.InitFlags(nil) + // Opt into the new klog behavior so that -stderrthreshold is honored even + // when -logtostderr=true (the default). + // Ref: kubernetes/klog#212, kubernetes/klog#432 + flag.Set("legacy_stderr_threshold_behavior", "false") //nolint:errcheck + flag.Set("stderrthreshold", "INFO") //nolint:errcheck ctrllog.SetLogger(textlogger.NewLogger(textlogger.NewConfig())) logger := ctrllog.Log.WithName("entrypoint")