-
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
Fix capacityType label in AWS ManagedNodeGroup #6261
Conversation
7cd73bc
to
17e99a2
Compare
Fixes an issue where the capacityType label inferred from an empty EKS ManagedNodeGroup does not match the same label on the node after it is created and joins the cluster
17e99a2
to
7ffb662
Compare
/assign @vadasambar |
A nit, LGTM otherwise. Description is easy to understand (thank you) |
/lgtm |
@drmorr0 , @gjtempleton need your approval. |
Thanks for this! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gjtempleton, sibucan, vadasambar 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When using a ManagedNodeGroup (MNG), CAS is supposed to use the EKS's DescribeNodegroup API call to get the information about the nodes in the NodeGroup to know where a Pod is supposed to go if no nodes currently exist for the MNG. This is because there's currently no native way of setting tags on a MNG's underlying ASG using the MNG API, and CAS traditionally depended on the ASG's tags to be able to tell when it should scale up from 0 when a Pod could potentially fit there.
However, the
capacityType
label that CAS gets from the DescribeNodegroup API call is missing a crucial prefix. A Spot instance node will have theeks.amazonaws.com/capacityType
label placed on it, but when CAS gets the node label list from the API, it'll look like this:Note that the label CAS determined from the API call was:
In a real node, the labels look like this (taken from
kubectl describe node
):So if I tried to schedule a Pod using the following nodeaffinity:
The CAS will see that my Spot MNG (with discovered label
capacityType: SPOT
) will "never" be able to fit my Pod that requestseks.amazonaws.com/capacityType: SPOT
, and says "we can't fit your Pod in the cluster":However, If I used the "wrong" label
capacityType: SPOT
, CAS will autoscale the correct MNG, but my Pod then stays Pending because the label on the actual node has theeks.amazonaws.com
prefix and so my Pod's nodeAffinity differs and can't actually get scheduled into that node. 😢The fix in here makes it so the autodiscovered label is the same one that's placed on the nodes once the MNG scales up for the first time.
Note: This does not happen when there's at least one node in the MNG, as CAS will then cache the correct set of labels, since it will circumvent the need for EKS's DescribeNodegroup API.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?