Skip to content
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

Merged
merged 2 commits into from
Apr 6, 2017

Conversation

nikhiljindal
Copy link
Contributor

@nikhiljindal nikhiljindal commented Apr 5, 2017

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

Fix for [failure to delete federation controllers with finalizers](https://github.com/kubernetes/kubernetes/issues/43828).

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 5, 2017
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Apr 5, 2017
@nikhiljindal nikhiljindal added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Apr 5, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@marun
Copy link
Contributor

marun commented Apr 5, 2017

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]) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 5, 2017
@k8s-cherrypick-bot
Copy link

Removing label cherrypick-candidate because no release milestone was set. This is an invalid state and thus this PR is not being considered for cherry-pick to any release branch. Please add an appropriate release milestone and then re-add the label.

@nikhiljindal
Copy link
Contributor Author

@k8s-bot non-cri e2e test this

@nikhiljindal
Copy link
Contributor Author

Verified that federation e2e tests pass.
This is now good to go.
Adding LGTM as per approval from @csbell

/lgtm

@k8s-ci-robot
Copy link
Contributor

@nikhiljindal: you cannot LGTM your own PR.

In response to this comment:

Verified that federation e2e tests pass.
This is now good to go.
Adding LGTM as per approval from @csbell

/lgtm

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.

@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@nikhiljindal nikhiljindal added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 6, 2017
@k8s-ci-robot
Copy link
Contributor

@nikhiljindal: The following test(s) failed:

Test name Commit Details Rerun command
Jenkins non-CRI GCE e2e 607d341 link @k8s-bot non-cri e2e test this

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.

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 44084, 42964)

@k8s-github-robot k8s-github-robot merged commit 586e6d0 into kubernetes:master Apr 6, 2017
k8s-github-robot pushed a commit that referenced this pull request Apr 11, 2017
…#44084-upstream-release-1.6

Automatic merge from submit-queue

Automated cherry pick of #44084

Cherry pick of #44084 on release-1.6.

#44084: Removing both finalizers in federation controller in a

```release-note
Fix for [failure to delete federation controllers with finalizers](#43828).
```
@k8s-cherrypick-bot
Copy link

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.

@enisoc enisoc added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Apr 13, 2017
mintzhao pushed a commit to mintzhao/kubernetes that referenced this pull request Jun 1, 2017
…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).
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants