-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Adding functionality to cordon the node before destroying it. #3649
Adding functionality to cordon the node before destroying it. #3649
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
Welcome @atulaggarwal! |
Signed now |
Can someone review the PR and let me know if this kind of change make sense in autoscaler? |
FWIW I still believe the right solution is to make ingress controller aware of autoscaler taint (ex. ingress-gce). spec.Unschedulable has the problem of not having a clear owner, though the idea of pairing it with a taint as implemented in here somewhat mitigates this issue. (edit: Also there is no way for certain pods to tolerate it, which is potentially useful for things like logging daemonsets). At a glance I'm not sure why we need 2 separate taints? Why not just skip default tainting logic and apply the ToBeDeletedTaint in cordoning logic? Having 2 separate writes on the node is a big downside as mutating api-server calls can be a big bottleneck when trying to scale-down large cluster rapidly. I'm focusing on preparing patch releases now, I can do a more detailed review later this week. |
Thanks for the brief review.
Edit - Added PR link and fixed typos |
@MaciekPytel - Can you review the PR once and let me know if everything looks fine? |
Folks why aren't we working on this? Can someone from the admin review? |
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'm +1 for adding this
/approve
@feiskyer thank you for the review and the approval. |
@Jeffwan do you mind review this PR as well? |
@@ -205,6 +209,10 @@ func cleanTaint(node *apiv1.Node, client kube_client.Interface, taintKey string) | |||
} | |||
|
|||
freshNode.Spec.Taints = newTaints | |||
if cordonNode { | |||
klog.V(1).Infof("Successfully uncordoned node %v by Cluster Autoscaler", freshNode.Name) |
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.
Given that the update has not yet happened this message is premature.
cluster-autoscaler/main.go
Outdated
@@ -174,6 +174,7 @@ var ( | |||
awsUseStaticInstanceList = flag.Bool("aws-use-static-instance-list", false, "Should CA fetch instance types in runtime or use a static list. AWS only") | |||
enableProfiling = flag.Bool("profiling", false, "Is debug/pprof endpoint enabled") | |||
clusterAPICloudConfigAuthoritative = flag.Bool("clusterapi-cloud-config-authoritative", false, "Treat the cloud-config flag authoritatively (do not fallback to using kubeconfig flag). ClusterAPI only") | |||
cordonNodeBeforeTerminate = flag.Bool("cordon-node-before-terminating", true, "Should CA cordon nodes before terminating during downscale process") |
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.
Please launch new features initially disabled.
@@ -117,6 +117,10 @@ func addTaintToSpec(node *apiv1.Node, taintKey string, effect apiv1.TaintEffect) | |||
Value: fmt.Sprint(time.Now().Unix()), | |||
Effect: effect, | |||
}) | |||
if cordonNode { | |||
klog.V(1).Infof("Successfully cordoned node %v by Cluster Autoscaler", node.Name) |
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.
The update has not yet completed. The message is premature.
@mwielgus - Thanks for reviewing the PR. I have made the changes as per the review comments. Please review it once more. |
Please squash commits to just 1. |
…lps load balancer to remove the node from healthy hosts (ALB does have this support). This won't fix the issue of 502 completely as there is some time node has to live even after cordoning as to serve In-Flight request but load balancer can be configured to remove Cordon nodes from healthy host list. This feature is enabled by cordon-node-before-terminating flag with default value as false to retain existing behavior.
839811f
to
7670d7b
Compare
@mwielgus - Done |
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: atulaggarwal, feiskyer, mwielgus 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 |
For future reference - there is a growing number of request for CA to take additional custom actions as part of the drain (ex. #3792) and I'd like to propose extracting drain logic into processor as a long-term solution. |
There's a release cycle, you will need to cherry-pick this merge to branches and next release will pick them up. |
@Jeffwan thank you for getting back to me, may you please tell me when the next release cycle is going to happen? |
I don't think this would solve issue #2045. This PR justs add UnSchedulable label to node being evicted so that it could be removed from load balancer. It would not change any way scheduling of pods before deleting the node. |
@Jeffwan i've created a dev docker release for my staging testing, still waiting on the official release for prod. |
@atulaggarwal I want to build a docker image for k8 would you be able to provide the fixes in other branches as well instead of master? |
@ltagliamonte-dd Please cherry-pick this change to release branch. @kubernetes/autoscaler-maintainers will help cut release later. |
cherry pick #3649 - Adding functionality to cordon the node before destroying it.
cherry pick #3649 - Adding functionality to cordon the node before destroying it.
This feature was added on k8s autoscaler on Oct 2020: kubernetes/autoscaler#3649 but kops didn't provide support to add it via the autoscaler addon This PR adds it
This feature was added on k8s autoscaler on Oct 2020: kubernetes/autoscaler#3649 but kops didn't provide support to add it via the autoscaler addon This PR adds it
This feature was added on k8s autoscaler on Oct 2020: kubernetes/autoscaler#3649 but kops didn't provide support to add it via the autoscaler addon This PR adds it
This helps load balancer to remove the node from healthy hosts (ALB does have this support).
This won't fix the issue of 502 completely as there is some time node to live even after cordoning as to serve In-Flight request.
Shamelessly copied from https://github.com/kubernetes/autoscaler/pull/3014/files