-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Removing both finalizers in federation controllers in a single update #44084
Removing both finalizers in federation controllers in a single update #44084
Conversation
I think it would be preferable to use sets.String rather than a slice, but I guess that would be even more work. |
configmap := obj.(*apiv1.ConfigMap) | ||
newFinalizers := []string{} | ||
hasFinalizer := false | ||
for i := range configmap.ObjectMeta.Finalizers { | ||
if string(configmap.ObjectMeta.Finalizers[i]) != finalizer { | ||
if !sliceutils.ContainsString(finalizers, configmap.ObjectMeta.Finalizers[i]) { |
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'd move this as a utility in deletion_helper.go.
deletion_helper.HasFinalizer(finalizers, configmap.ObjectMeta.Finalizers[i])
Clarifies the code and removes the util/slice dependency in all the callers.
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.
Moved ContainsString to deletionhelper/util.go.
I am working on another PR to remove all this duplication.
8e4eb70
to
4749e58
Compare
4749e58
to
e75a3df
Compare
Removing label |
@k8s-bot non-cri e2e test this |
e75a3df
to
607d341
Compare
Verified that federation e2e tests pass. /lgtm |
@nikhiljindal: you cannot LGTM your own PR. In response to this comment:
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. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nikhiljindal
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@nikhiljindal: The following test(s) failed:
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
Automatic merge from submit-queue (batch tested with PRs 44084, 42964) |
Commit found in the "release-1.6" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
…y-pick-of-#44084-upstream-release-1.6 Automatic merge from submit-queue Automated cherry pick of kubernetes#44084 Cherry pick of kubernetes#44084 on release-1.6. kubernetes#44084: Removing both finalizers in federation controller in a ```release-note Fix for [failure to delete federation controllers with finalizers](kubernetes#43828). ```
Fixes #43828
There is a bug right now where the controller fails to delete the object if one finalizer is removed and the second isnt.
This updates the code so that both the finalizers are removed in a single API call. Kept the code changes minimum to enable cherrypick in 1.6.x
cc @csbell @kubernetes/sig-federation-bugs