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

Improve delete node mechanisms for cluster-api autoscaler provider #3034

Merged
merged 2 commits into from
Jun 4, 2020

Conversation

elmiko
Copy link
Contributor

@elmiko elmiko commented Apr 8, 2020

This change is being proposed to improve the mechanism for applying and removing deletion annotations. In some situations it is possible for the CAPI provider to leave unwanted deletion annotations after a scale down to the minimum size. The two commits in this patch add a mechanism for unmarking scalable resources and an additional check for reducing a node group below minimum size.

/area provider/cluster-api

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 8, 2020
@elmiko
Copy link
Contributor Author

elmiko commented Apr 8, 2020

/area provider/cluster-api

@elmiko
Copy link
Contributor Author

elmiko commented Jun 3, 2020

cc @enxebre @joelsmith @detiber

elmiko added 2 commits June 3, 2020 15:05
This change adds a function to remove the annotations associated with
marking a node for deletion. It also adds logic to unmark a node in the
event that an error is returned after the node has been annotated but
before it has been removed. In the case where a node cannot be removed
(eg due to minimum size), the node is unmarked before we return from the
error condition.
This change removes a few nil checks against resources returned in the
Mark and Unmark deletion functions of the cluster-autoscaler CAPI
provider. These checks look to see if the returned value for a resource
are nil, but the function will not return nil if it returns an
error[0]. We only need to check the error return as discussed here[1].

[0]
https://github.com/kubernetes/client-go/blob/master/dynamic/simple.go#L234
[1]
https://github.com/openshift/kubernetes-autoscaler/pull/141/files#r414480960
@elmiko
Copy link
Contributor Author

elmiko commented Jun 3, 2020

thanks @detiber, i had forgotten to re-pick the original commit after i changed it. should be up to date now.

@detiber
Copy link
Member

detiber commented Jun 3, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 3, 2020
@enxebre
Copy link
Member

enxebre commented Jun 4, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

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 Jun 4, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9b1f6e2 into kubernetes:master Jun 4, 2020
@elmiko elmiko deleted the improve-delete branch June 4, 2020 13:13
k8s-ci-robot added a commit that referenced this pull request Jul 29, 2020
[CA-1.18] #3034 cherry-pick: Improve delete node mechanisms for cluster-api autoscaler provider #3034
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. area/provider/cluster-api Issues or PRs related to Cluster API provider 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants