-
Notifications
You must be signed in to change notification settings - Fork 924
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
operator: fix the issue that the default values of Karmada are not correctly applied #6158
Conversation
operatorscheme.Scheme.Default(karmada) | ||
|
||
if updated || !reflect.DeepEqual(karmada.Spec, older.Spec) { | ||
if updated || isSpecUpdated { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the update operation also be placed before validateKarmada?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update operation should only be carried out when the validation is passed
The update
operation, you mean controllerutil.AddFinalizer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's appropriate. Can this update be placed before validate?
karmada/operator/pkg/controller/karmada/controller.go
Lines 136 to 141 in 006cf70
updated := controllerutil.AddFinalizer(karmada, ControllerFinalizerName) | |
if _, isExist := karmada.Labels[DisableCascadingDeletionLabel]; !isExist { | |
labelMap := labels.Merge(karmada.GetLabels(), labels.Set{DisableCascadingDeletionLabel: "false"}) | |
karmada.SetLabels(labelMap) | |
updated = true | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's appropriate. Can this update be placed before validate?
@XiShanYongYe-Chang updated, does it meet your expectations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~
/lgtm
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #6158 +/- ##
==========================================
- Coverage 48.10% 48.07% -0.03%
==========================================
Files 668 668
Lines 55316 55327 +11
==========================================
- Hits 26608 26598 -10
- Misses 26973 26991 +18
- Partials 1735 1738 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
f35d1e5
to
fff2128
Compare
…rrectly applied Signed-off-by: zhzhuang-zju <[email protected]>
fff2128
to
df7f007
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When the operator reconciles the Karmada CR, it will first validate the Karmada CR and then set the default values. This causes the validation to fail when users omit the configuration of certain fields.
It is necessary to set the default values first and then perform the validation.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
How to reproduce it:
Does this PR introduce a user-facing change?: