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

[0.1] Get updated cluster before removing finalizers #1173

Merged

Conversation

ncdc
Copy link
Contributor

@ncdc ncdc commented Jul 18, 2019

What this PR does / why we need it:
If the cluster actuator's Delete() call updates the cluster in the
apiserver, there is a possibility that in-memory cluster object in the
cluster controller is now out of date. We either need to get-then-update
the cluster to remove the finalizer, or we need to use patch. The
version of controller-runtime we're using in release-0.1 does not
support patch in its generic client, so this change adds the
get-then-update logic, and wraps it inside a retry on conflict loop.

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 #

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

Fixed an issue where cluster deletion could get stuck in an endless conflict loop.

If the cluster actuator's Delete() call updates the cluster in the
apiserver, there is a possibility that in-memory cluster object in the
cluster controller is now out of date. We either need to get-then-update
the cluster to remove the finalizer, or we need to use patch. The
version of controller-runtime we're using in release-0.1 does not
support patch in its generic client, so this change adds the
get-then-update logic, and wraps it inside a retry on conflict loop.

Signed-off-by: Andy Goldstein <goldsteina@vmware.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 18, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 18, 2019
@ncdc ncdc changed the title Get updated cluster before removing finalizers [0.1] Get updated cluster before removing finalizers Jul 18, 2019
@vincepri
Copy link
Member

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncdc, vincepri

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit 9418040 into kubernetes-sigs:release-0.1 Jul 18, 2019
//
// Note 2, this is not a Patch call because the version of controller-runtime in the release-0.1 branch
// does not support patching.
err := r.Get(context.Background(), request.NamespacedName, cluster)
Copy link
Contributor

@akutz akutz Jul 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ncdc,

the version of controller-runtime in the release-0.1 branch does not support patching.

What do you mean? Both CAPA and CAPV using CAPI release-0.1 patch the cluster object using a JSON patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controller-runtime's generic client doesn't have Patch support

thorsteinnth added a commit to NetApp/cluster-api that referenced this pull request Aug 7, 2019
* Get updated cluster before removing finalizers (kubernetes-sigs#1173)

If the cluster actuator's Delete() call updates the cluster in the
apiserver, there is a possibility that in-memory cluster object in the
cluster controller is now out of date. We either need to get-then-update
the cluster to remove the finalizer, or we need to use patch. The
version of controller-runtime we're using in release-0.1 does not
support patch in its generic client, so this change adds the
get-then-update logic, and wraps it inside a retry on conflict loop.

Signed-off-by: Andy Goldstein <goldsteina@vmware.com>

* Update lodash version to address CVE (kubernetes-sigs#1156)

Signed-off-by: Andy Goldstein <goldsteina@vmware.com>

* Update Netlify config for v1alpha1 subdomain (kubernetes-sigs#1176)

* Release v0.1.8 (kubernetes-sigs#1183)
@ncdc ncdc deleted the cluster-delete-patch-finalizers branch September 6, 2019 18:00
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants