Skip to content

feat(pkg): support modifying feature gates #6226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

liubog2008
Copy link
Member

@liubog2008 liubog2008 commented May 30, 2025

Ref: #6199

  • support modifying feature gates
  • add a new feature FeatureModification
  • add validation for feature gates
    • can only enable FeatureModification if it is not enabled
    • cannot disable FeatureModification

manually test:

  • upgrade operator for tidb clusters with DisablePDDefaultReadinessProbe feature.
    • revision is changed and pods are not restarted.
  • enable FeatureModification
    • revision is changed and pods are not restarted.
  • enable/disable DisablePDDefaultReadinessProbe
    • rolling update pds

@github-actions github-actions bot added the v2 for operator v2 label May 30, 2025
Copy link

/run-pull-e2e-kind-v2

@ti-chi-bot ti-chi-bot bot added the size/XXL label May 30, 2025
@ti-chi-bot ti-chi-bot bot requested a review from shonge May 30, 2025 10:03
@codecov-commenter
Copy link

codecov-commenter commented May 30, 2025

Codecov Report

Attention: Patch coverage is 31.98529% with 185 lines in your changes missing coverage. Please review.

Please upload report for BASE (feature/v2@283e8b1). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff              @@
##             feature/v2    #6226   +/-   ##
=============================================
  Coverage              ?   46.68%           
=============================================
  Files                 ?      298           
  Lines                 ?    19637           
  Branches              ?        0           
=============================================
  Hits                  ?     9168           
  Misses                ?    10469           
  Partials              ?        0           
Flag Coverage Δ
unittest 46.68% <31.98%> (?)

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

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

Copy link

github-actions bot commented Jun 3, 2025

/run-pull-e2e-kind-v2

Comment on lines 159 to 172
func featuresUpToDate(c *v1alpha1.Cluster, fs []metav1alpha1.Feature) bool {
if len(fs) != len(c.Spec.FeatureGates) {
return false
}

for i, f := range fs {
if c.Spec.FeatureGates[i].Name != f {
return false
}
}

return true
}

Copy link
Member

Choose a reason for hiding this comment

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

Do not need to sort?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's ordered by users.

Comment on lines +175 to +181
if f, ok := spec["features"]; ok {
specCopy["features"] = f
}
template["$patch"] = "replace"
objCopy["spec"] = specCopy
patch, err := json.Marshal(objCopy)

Copy link
Member

Choose a reason for hiding this comment

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

Will this make existing clusters restart?

Copy link
Member Author

Choose a reason for hiding this comment

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

revision will be changed.

Comment on lines 78 to 93
func equalFeatures[
A ~string,
B ~string,
](a []A, b []B) bool {
if len(a) != len(b) {
return false
}

for i := range a {
if string(a[i]) != string(b[i]) {
return false
}
}

return true
}
Copy link
Member

Choose a reason for hiding this comment

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

Need to sort?

@liubog2008 liubog2008 force-pushed the liubo02/support-feature-gates branch from bf8de0b to c01f79e Compare June 4, 2025 03:49
Copy link

github-actions bot commented Jun 4, 2025

/run-pull-e2e-kind-v2

@liubog2008 liubog2008 force-pushed the liubo02/support-feature-gates branch from c01f79e to 6c481cb Compare June 4, 2025 03:49
Copy link

github-actions bot commented Jun 4, 2025

/run-pull-e2e-kind-v2

Signed-off-by: liubo02 <[email protected]>
Copy link

github-actions bot commented Jun 4, 2025

/run-pull-e2e-kind-v2

Signed-off-by: liubo02 <[email protected]>
@ti-chi-bot ti-chi-bot bot removed the lgtm label Jun 4, 2025
Copy link

github-actions bot commented Jun 4, 2025

/run-pull-e2e-kind-v2

@fgksgf
Copy link
Member

fgksgf commented Jun 4, 2025

/lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Jun 4, 2025
@liubog2008
Copy link
Member Author

/test pull-e2e

Copy link
Contributor

ti-chi-bot bot commented Jun 4, 2025

@liubog2008: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-e2e 3288029 link false /test pull-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@liubog2008
Copy link
Member Author

/run-pull-e2e-kind-v2

Signed-off-by: liubo02 <[email protected]>
@ti-chi-bot ti-chi-bot bot removed the lgtm label Jun 4, 2025
Copy link

github-actions bot commented Jun 4, 2025

/run-pull-e2e-kind-v2

1 similar comment
@liubog2008
Copy link
Member Author

/run-pull-e2e-kind-v2

Signed-off-by: liubo02 <[email protected]>
Copy link

github-actions bot commented Jun 5, 2025

/run-pull-e2e-kind-v2

Copy link

github-actions bot commented Jun 5, 2025

/run-pull-e2e-kind-v2

Copy link

pingcap-cla-assistant bot commented Jun 5, 2025

CLA assistant check
All committers have signed the CLA.

@fgksgf
Copy link
Member

fgksgf commented Jun 5, 2025

/lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Jun 5, 2025
Copy link
Contributor

ti-chi-bot bot commented Jun 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fgksgf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

Copy link
Contributor

ti-chi-bot bot commented Jun 5, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-06-04 06:50:35.303819859 +0000 UTC m=+424521.506165119: ☑️ agreed by fgksgf.
  • 2025-06-04 07:29:46.001598835 +0000 UTC m=+426872.203944100: ✖️🔁 reset by liubog2008.
  • 2025-06-04 08:00:05.664025538 +0000 UTC m=+428691.866370800: ☑️ agreed by fgksgf.
  • 2025-06-04 10:23:28.872568019 +0000 UTC m=+437295.074913283: ✖️🔁 reset by liubog2008.
  • 2025-06-05 03:26:07.889416335 +0000 UTC m=+498654.091761600: ☑️ agreed by fgksgf.

@ti-chi-bot ti-chi-bot bot merged commit 755828e into pingcap:feature/v2 Jun 5, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants