dnsmasq-nanny: honor -stderrthreshold flag via klog v2.140.0#763
Draft
pierluigilenoci wants to merge 1 commit intokubernetes:masterfrom
Draft
dnsmasq-nanny: honor -stderrthreshold flag via klog v2.140.0#763pierluigilenoci wants to merge 1 commit intokubernetes:masterfrom
pierluigilenoci wants to merge 1 commit intokubernetes:masterfrom
Conversation
klog v2 defaults -logtostderr=true, which silently overrides -stderrthreshold. This makes it impossible to filter log output by severity level using the -stderrthreshold flag. klog v2.140.0 (kubernetes/klog#432) introduced the legacy_stderr_threshold_behavior feature flag that fixes this behavior (upstream issue: kubernetes/klog#212). Changes: - Bump k8s.io/klog/v2 from v2.130.1 to v2.140.0 - After klog.InitFlags(nil), set legacy_stderr_threshold_behavior=false and stderrthreshold=INFO so that -stderrthreshold is honored even when -logtostderr=true Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com> Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
Contributor
|
Skipping CI for Draft Pull Request. |
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pierluigilenoci The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
klog v2 defaults
-logtostderr=true, which silently overrides-stderrthreshold. This makes it impossible to filter log output by severity level using the-stderrthresholdflag in dnsmasq-nanny.klog v2.140.0 (kubernetes/klog#432) introduced the
legacy_stderr_threshold_behaviorfeature flag that fixes this long-standing behavior (upstream issue: kubernetes/klog#212).Changes
k8s.io/klog/v2from v2.130.1 to v2.140.0cmd/dnsmasq-nanny/main.go: Afterklog.InitFlags(nil), setlegacy_stderr_threshold_behavior=falseandstderrthreshold=INFOso that-stderrthresholdis honored even when-logtostderr=true(the default)Why
Without this fix, passing
-stderrthreshold=WARNING(or any other severity) to dnsmasq-nanny has no effect because klog's legacy behavior copies all log output to stderr regardless of the threshold. The new klog flag restores the expected semantics: only messages at or above the configured severity threshold are written to stderr.Testing
go build ./cmd/dnsmasq-nanny/...succeedsgo build ./cmd/kube-dns/...succeedsgo build ./cmd/sidecar/...succeedsnode-cachehas a pre-existing build failure on non-Linux due to iptables dependency — unrelated to this change)