-
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
aws: check for all possible Terminated states #6166
Conversation
It's possible that an EC2 instance is in the Terminated state for multiple autoscaler loops, so to avoid trying to terminate it more than once and causing the bug seen for this initial fix, we include this check as well. Also, make the log more verbose and write out what state we found the instance in.
Welcome @tomwans! |
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.
@tomwans Hi! Thanks for the PR, and also for adding a test in. I'm a bit confused on the test; it seems like there are two instances, and one of them was already in the terminating state? So we expect the instance count to go from 2 -> 1? But at the end we are asserting that the target size is still 2. Maybe I'm missing something, though.
cluster-autoscaler/cloudprovider/aws/aws_cloud_provider_test.go
Outdated
Show resolved
Hide resolved
@drmorr0 thanks for the review. I cleaned up the test a bit, please let me know how it looks now. It just seems like the TerminatingWait test was copy pasted from something else, with light adjustments. The expectedInstanceCount variable is not really relevant, it was just a distraction. I reworded some of that from the Terminated test I added. If you'd like, I can copy paste this and do the same for the TerminatingWait test, so they look the same. Or, I can just bring them all in to one test and do a table test, which might be fine since we expect the same result out of all the states anyway. I have no preference. What do you think? |
@tomwans If you have some time and it's not terribly difficult, putting into a table test would be nice, I guess? But I don't have particularly strong feelings on the matter, so if you don't have time/want to just ship it, I'll stamp it. |
Let's just stamp it out. Theres no other case of table tests in this test file, so it wouldn't be matching conventions anyway. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: drmorr0, tomwans 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 |
Brings in: kubernetes#5411 kubernetes#6166 But the code is so different I manually brought it up to speed.
bring up AWS patch for termination Brings in: kubernetes#5411 kubernetes#6166 But the code is so different I manually brought it up to speed. Also, I added a patch to make tests pass in the latest version of Go.
What type of PR is this?
/kind bug
What this PR does / why we need it:
It's possible that an EC2 instance is in the Terminated state for multiple autoscaler loops, so to avoid trying to terminate it more than once and causing the bug seen for this initial fix, we include this check as well.
Also, make the log more verbose and write out what state we found the instance in.
This builds upon this change: #5411