Skip to content

fix: honor --stderrthreshold flag when --logtostderr is enabled (#6786)#6789

Merged
ti-chi-bot[bot] merged 2 commits intopingcap:release-1.6from
ti-chi-bot:cherry-pick-6786-to-release-1.6
Apr 3, 2026
Merged

fix: honor --stderrthreshold flag when --logtostderr is enabled (#6786)#6789
ti-chi-bot[bot] merged 2 commits intopingcap:release-1.6from
ti-chi-bot:cherry-pick-6786-to-release-1.6

Conversation

@ti-chi-bot
Copy link
Copy Markdown
Member

This is an automated cherry-pick of #6786

What this PR does

The backup manager calls pflag.Set("logtostderr", "true") which enables klog's logtostderr mode. However, due to klog's legacy behavior, the --stderrthreshold flag is silently ignored when logtostderr is true.

This PR:

  1. Adds proper error handling for the existing bare pflag.Set("logtostderr", "true") call
  2. Opts into the fixed behavior introduced in klog v2.130.0 by setting:
    • legacy_stderr_threshold_behavior=false — disables the legacy override
    • stderrthreshold=INFO — preserves the current default behavior
  3. Bumps klog/v2 from v2.110.1 to v2.140.0

After this change, the --stderrthreshold flag works as expected in the backup manager.

Why

See upstream fix: kubernetes/klog#432

When logtostderr is enabled in the backup manager, klog's legacy behavior
ignores the stderrthreshold flag. This opts into the fixed behavior
introduced in klog v2.130.0 by setting legacy_stderr_threshold_behavior=false.

Also adds proper error handling for the existing bare pflag.Set() call.

See: kubernetes/klog#432
Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
Update k8s.io/klog/v2 from v2.110.1 to v2.140.0 and
github.com/go-logr/logr from v1.3.0 to v1.4.1 in pkg/apis
and pkg/client submodules to match the main module versions.

This fixes the check-modules CI verification failure.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@pingcap-cla-assistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@liubog2008
Copy link
Copy Markdown
Member

/test pull-e2e-kind-basic

1 similar comment
@liubog2008
Copy link
Copy Markdown
Member

/test pull-e2e-kind-basic

@liubog2008
Copy link
Copy Markdown
Member

/lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Apr 3, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Apr 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liubog2008

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

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Apr 3, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-03 01:25:17.87064474 +0000 UTC m=+487523.076004787: ☑️ agreed by liubog2008.

@ti-chi-bot ti-chi-bot bot added the approved label Apr 3, 2026
@ti-chi-bot ti-chi-bot bot merged commit 0dd972c into pingcap:release-1.6 Apr 3, 2026
14 of 15 checks passed
@ti-chi-bot ti-chi-bot bot deleted the cherry-pick-6786-to-release-1.6 branch April 3, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants