Skip to content

Remove deprecated flags in controller manager options#7271

Merged
karmada-bot merged 1 commit intokarmada-io:masterfrom
dahuo98:remove-deprecated-flags-from-karmada-controller-manager
Mar 31, 2026
Merged

Remove deprecated flags in controller manager options#7271
karmada-bot merged 1 commit intokarmada-io:masterfrom
dahuo98:remove-deprecated-flags-from-karmada-controller-manager

Conversation

@dahuo98
Copy link
Copy Markdown
Contributor

@dahuo98 dahuo98 commented Mar 9, 2026

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Removes deprecated flags --cluster-lease-duration and --cluster-lease-renew-interval-fraction for controller manager
These flags were previously deprecated in #7126

Which issue(s) this PR fixes:

Part of #7009

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: The flags `--cluster-lease-duration` and `--cluster-lease-renew-interval-fraction` are removed now

Copilot AI review requested due to automatic review settings March 9, 2026 18:50
@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 9, 2026
@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 9, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on code cleanup by eliminating two deprecated and unused command-line flags from the controller manager's options. This action streamlines the codebase, reduces potential confusion for users, and improves overall maintainability by removing obsolete configurations.

Highlights

  • Deprecated Flag Removal: The --cluster-lease-duration and --cluster-lease-renew-interval-fraction flags have been removed from the controller manager options. These flags were previously marked as deprecated and unused.
Changelog
  • cmd/controller-manager/app/options/options.go
    • Removed the --cluster-lease-duration flag and its associated deprecation marking.
    • Removed the --cluster-lease-renew-interval-fraction flag and its associated deprecation marking.
Activity
  • No review activity or comments have been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dahuo98 dahuo98 changed the title remove deprecated flags in controller manager options Remove deprecated flags in controller manager options Mar 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes deprecated CLI flags from karmada-controller-manager option registration, as part of the release cleanup work to fully drop flags deprecated in #7126.

Changes:

  • Removed --cluster-lease-duration and --cluster-lease-renew-interval-fraction flag registration from controller-manager options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 185 to 189
flags.DurationVar(&o.LeaderElection.RetryPeriod.Duration, "leader-elect-retry-period", defaultElectionRetryPeriod.Duration, ""+
"The duration the clients should wait between attempting acquisition and renewal "+
"of a leadership. This is only applicable if leader election is enabled.")
flags.DurationVar(&o.ClusterLeaseDuration.Duration, "cluster-lease-duration", 40*time.Second,
"Specifies the expiration period of a cluster lease.")
_ = flags.MarkDeprecated("cluster-lease-duration", "The flag --cluster-lease-duration has been marked deprecated because it has never been used, and will be removed in a future release.")
flags.Float64Var(&o.ClusterLeaseRenewIntervalFraction, "cluster-lease-renew-interval-fraction", 0.25,
"Specifies the cluster lease renew interval fraction.")
_ = flags.MarkDeprecated("cluster-lease-renew-interval-fraction", "The flag --cluster-lease-renew-interval-fraction has been marked deprecated because it has never been used, and will be removed in a future release.")
flags.DurationVar(&o.ClusterSuccessThreshold.Duration, "cluster-success-threshold", 30*time.Second, "The duration of successes for the cluster to be considered healthy after recovery.")
flags.DurationVar(&o.ClusterFailureThreshold.Duration, "cluster-failure-threshold", 30*time.Second, "The duration of failure for the cluster to be considered unhealthy.")
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these flag bindings also removes the only place ClusterLeaseDuration and ClusterLeaseRenewIntervalFraction get non-zero defaults. NewOptions() currently leaves them at zero values, but opts.Validate() requires ClusterLeaseDuration > 0 and 0 < ClusterLeaseRenewIntervalFraction < 1, so karmada-controller-manager will now fail to start. Set defaults for these fields in NewOptions() (e.g., 40s and 0.25 as before) or remove/adjust the validation + downstream usage if they are truly no longer needed.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per discussed here #7009 (comment), we will stop populating these fields. I removed the validation checks on these 2 fields

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly removes two deprecated flags, --cluster-lease-duration and --cluster-lease-renew-interval-fraction, from the controller manager. The code change itself is straightforward and correct. I have added one comment regarding the formatting of the release note in the pull request description to ensure it aligns with the project's style guide.

I am having trouble creating individual review comments. Click here to see my feedback.

cmd/controller-manager/app/options/options.go (188-193)

medium

The release note in the pull request description does not adhere to the repository's style guide. According to the style guide, release notes for this category of change should use the simple past tense.

For example:

`karmada-controller-manager`: Removed the deprecated flags `--cluster-lease-duration` and `--cluster-lease-renew-interval-fraction`.
References
  1. Release notes for categories like features, fixes, and cleanups should use the simple past tense (e.g., 'Fixed...', 'Added...', 'Removed...'). The current release note uses present tense ('are removed now') instead of the simple past tense. (link)

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 9, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.02%. Comparing base (105c6ef) to head (67d01c0).
⚠️ Report is 53 commits behind head on master.

Files with missing lines Patch % Lines
cmd/controller-manager/app/controllermanager.go 0.00% 32 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7271      +/-   ##
==========================================
+ Coverage   41.99%   42.02%   +0.03%     
==========================================
  Files         874      874              
  Lines       53542    53537       -5     
==========================================
+ Hits        22483    22497      +14     
+ Misses      29372    29347      -25     
- Partials     1687     1693       +6     
Flag Coverage Δ
unittests 42.02% <0.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dahuo98 dahuo98 force-pushed the remove-deprecated-flags-from-karmada-controller-manager branch from a15bd8c to 63c294d Compare March 9, 2026 19:20
@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 9, 2026
@dahuo98 dahuo98 force-pushed the remove-deprecated-flags-from-karmada-controller-manager branch from 63c294d to 74dab4b Compare March 9, 2026 20:11
@dahuo98 dahuo98 requested a review from Copilot March 9, 2026 20:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 37 to 42
if o.ClusterStatusUpdateFrequency.Duration <= 0 {
errs = append(errs, field.Invalid(newPath.Child("ClusterStatusUpdateFrequency"), o.ClusterStatusUpdateFrequency, "must be greater than 0"))
}
if o.ClusterLeaseDuration.Duration <= 0 {
errs = append(errs, field.Invalid(newPath.Child("ClusterLeaseDuration"), o.ClusterLeaseDuration, "must be greater than 0"))
}
if o.ClusterLeaseRenewIntervalFraction <= 0 || o.ClusterLeaseRenewIntervalFraction >= 1 {
errs = append(errs, field.Invalid(newPath.Child("ClusterLeaseRenewIntervalFraction"), o.ClusterLeaseRenewIntervalFraction, "must be greater than 0 and less than 1"))
}
if o.ClusterMonitorPeriod.Duration <= 0 {
errs = append(errs, field.Invalid(newPath.Child("ClusterMonitorPeriod"), o.ClusterMonitorPeriod, "must be greater than 0"))
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation for ClusterLeaseDuration / ClusterLeaseRenewIntervalFraction has been removed, but those fields are still present on Options (see cmd/controller-manager/app/options/options.go). If the fields are meant to be removed along with the flags, consider deleting them from the struct; if they’re intentionally kept for internal wiring, consider keeping basic validation or setting explicit defaults to prevent invalid/zero values from silently propagating.

Copilot uses AI. Check for mistakes.
@dahuo98 dahuo98 marked this pull request as draft March 9, 2026 20:55
@karmada-bot karmada-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 9, 2026
@zhzhuang-zju
Copy link
Copy Markdown
Contributor

/assign
Thanks @dahuo98. Once this pr is ready, please cc me to take a look :)

@dahuo98 dahuo98 force-pushed the remove-deprecated-flags-from-karmada-controller-manager branch from 74577e5 to 450056a Compare March 10, 2026 21:15
@mszacillo
Copy link
Copy Markdown
Member

/retest

@dahuo98 dahuo98 marked this pull request as ready for review March 11, 2026 20:24
@karmada-bot karmada-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2026
@dahuo98
Copy link
Copy Markdown
Contributor Author

dahuo98 commented Mar 11, 2026

/assign Thanks @dahuo98. Once this pr is ready, please cc me to take a look :)

@zhzhuang-zju Ready for review. Removed the deprecated flags as well as validation checks on these values. The e2e tests are a bit flaky and one of them failed initially. They passed with a retry.

@RainbowMango RainbowMango added this to the v1.18 milestone Mar 12, 2026
@zhzhuang-zju
Copy link
Copy Markdown
Contributor

Thanks
/assign

Copy link
Copy Markdown
Contributor

@zhzhuang-zju zhzhuang-zju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, others LGTM

@dahuo98 dahuo98 force-pushed the remove-deprecated-flags-from-karmada-controller-manager branch from 450056a to 2e8e0c9 Compare March 12, 2026 19:12
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 23, 2026
Signed-off-by: dahuo98 <sxdahuo@gmail.com>
@dahuo98 dahuo98 force-pushed the remove-deprecated-flags-from-karmada-controller-manager branch from 32fcea4 to 67d01c0 Compare March 23, 2026 19:41
@dahuo98 dahuo98 requested a review from zhzhuang-zju March 23, 2026 19:43
Copy link
Copy Markdown
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2026
@karmada-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 31, 2026
@karmada-bot karmada-bot merged commit 3d3888d into karmada-io:master Mar 31, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants