-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🐛 add finalizer to kcp in first reconcile to avoid race condition with delete #3199
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
🐛 add finalizer to kcp in first reconcile to avoid race condition with delete #3199
Conversation
Hi @jzhoucliqr. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
525ce8a
to
fb4d786
Compare
/ok-to-test |
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
/assign @detiber
We should probably remove https://github.com/kubernetes-sigs/cluster-api/pull/3199/files#diff-b9435e3ca04d94ed2d00d8754ddae768R218 now that we're setting the finalizer here |
util/util.go
Outdated
// FinalizerExists check if the given finalizer exists in the object o | ||
func FinalizerExists(o metav1.Object, finalizer string) bool { | ||
f := o.GetFinalizers() | ||
for _, e := range f { | ||
if e == finalizer { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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 really wish we could leverage controllerutil.ContainsFinalizer
here rather than having to add a helper for this here. @vincepri is it worth backporting kubernetes-sigs/controller-runtime@b999e72#diff-4c146d38c03cf55e321de9ad53af4452 to controller-runtime v0.5.x for that purpose?
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.
We can, I can cut a release today if you're able to backport it to release-0.5
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.
fb4d786
to
7b2d4ab
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
/milestone v0.3.7
7b2d4ab
to
0996e49
Compare
/test pull-cluster-api-verify |
/test pull-cluster-api-test |
0996e49
to
e84a8f6
Compare
/test pull-cluster-api-verify |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini, jzhoucliqr 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 |
+1 from me, surprised there haven't been more complaints about similar race conditions with the other controllers yet :) |
Sounds fair, if there is enough repetition everywhere, we should provide a generic utility? It can definitely come later though, no reason to do this in v0.3.7 |
This fix add finalizer to kcp and force requeue for the first reconciliation, before kcp init, to avoid race condition between kcp init and kcp delete.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #3198