-
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
fix(detector): Fix the invalid behavior in the detector to determine whether the binding object needs to be updated. #6157
Conversation
7ad6bca
to
7f0ba3a
Compare
Nice catching @CharlesQQ We add a new finalizer Based on this change, when the controller restarts, does the check on the binding object deepequal take effect? Do you have the test result? |
7f0ba3a
to
05dced1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #6157 +/- ##
==========================================
+ Coverage 48.07% 48.11% +0.03%
==========================================
Files 668 668
Lines 55327 55344 +17
==========================================
+ Hits 26597 26626 +29
+ Misses 26992 26982 -10
+ Partials 1738 1736 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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~
Do we need a release note?
/lgtm
/cc @RainbowMango
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.
/assign
pkg/util/label.go
Outdated
if existFinalizers == nil { | ||
return existFinalizers | ||
} |
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 don't understand why it needs a return here, but I don't think it should be.
Consider one situation where len(existFinalizer) != 0 and len(newFinalizers) > 0.
pkg/util/label.go
Outdated
if equality.Semantic.DeepEqual(existFinalizerSets, newFinalizerSets) { | ||
return existFinalizers | ||
} | ||
return newFinalizerSets.UnsortedList() |
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.
Here should return a sorted list, right?
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 order should be
items in exist
--> items in new
(but not in exist
)
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'll fix it, pls review again @RainbowMango
05dced1
to
8798d97
Compare
8798d97
to
1ba6616
Compare
I update the labels. |
/retest |
@CharlesQQ can you help add a release note? We need it when we cherry-pick it. |
@@ -560,6 +560,7 @@ func (d *ResourceDetector) ApplyClusterPolicy(object *unstructured.Unstructured, | |||
// Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists. | |||
bindingCopy.Annotations = util.DedupeAndMergeAnnotations(bindingCopy.Annotations, binding.Annotations) | |||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, binding.Labels) | |||
bindingCopy.Finalizers = util.DedupeAndMergeFinalizers(bindingCopy.Finalizers, binding.Finalizers) |
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.
Is this the only place that needs modification?
My understanding is that after the detector creates ResourceBindng/ClusterResourceBinding, downstream controllers could potentially append finalizers. Therefore, I think all places where updating RB/CRB should be fixed.
@XiShanYongYe-Chang What's your opinion?
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 think all places where updating RB/CRB should be fixed
Oh
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.
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.
done
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.
For the CRB, it is OK not to modify the CRB, because the dependency distribution does not add the related finalizer to the CRB resource.
Of course, the modification is better, which can avoid the same problem in the future.
1ba6616
to
3ae9f5e
Compare
/remove-kind feature |
@RainbowMango: Those labels are not set on the issue: In response to this:
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. |
Signed-off-by: chang.qiangqiang <[email protected]>
3ae9f5e
to
5d2fe25
Compare
Which release should I cherry-pick to? @XiShanYongYe-Chang |
We introduced this problem in v1.10, and we need to maintain the last three versions, so we need to cherry-pick it to the release-1.12, release-1.11 and release-1.10 branch. |
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 feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #6154
Special notes for your reviewer:
Does this PR introduce a user-facing change?: