Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/clientexample/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func streamingClientExample(url string) {
// demonstrates how to use event clients
func main() {
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
flag.Parse()
staticClientExample()
streamingClientExample("?creation_events=true&stream=true&oom_events=true&deletion_events=true")
Expand Down
5 changes: 5 additions & 0 deletions cmd/cadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func init() {
func main() {
klog.InitFlags(nil)
defer klog.Flush()
// 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
// Default logging verbosity to V(2)
_ = flag.Set("v", "2")
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
golang.org/x/sys v0.39.0
google.golang.org/grpc v1.79.3
google.golang.org/protobuf v1.36.10
k8s.io/klog/v2 v2.130.1
k8s.io/klog/v2 v2.140.0
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc=
k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 h1:jgJW5IePPXLGB8e/1wvd0Ich9QE97RvvF3a8J3fP/Lg=
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
Expand Down
5 changes: 5 additions & 0 deletions integration/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ func initRetryWhitelist() {

func main() {
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
flag.Parse()

// Check usage.
Expand Down
6 changes: 6 additions & 0 deletions integration/tests/api/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package api

import (
"flag"
"testing"
"time"

Expand All @@ -29,6 +30,11 @@ import (

func init() {
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
}

// Checks that expected and actual are within delta of each other.
Expand Down
6 changes: 6 additions & 0 deletions integration/tests/crio/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package crio

import (
"flag"
"testing"
"time"

Expand All @@ -29,6 +30,11 @@ import (

func init() {
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
}

// Checks that expected and actual are within delta of each other.
Expand Down
11 changes: 10 additions & 1 deletion integration/tests/healthz/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@

package healthz

import "k8s.io/klog/v2"
import (
"flag"

"k8s.io/klog/v2"
)

func init() {
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
}
5 changes: 5 additions & 0 deletions utils/oomparser/oomexample/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ import (
// demonstrates how to run oomparser.OomParser to get OomInstance information
func main() {
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
flag.Parse()
// out is a user-provided channel from which the user can read incoming
// OomInstance objects
Expand Down