-
Notifications
You must be signed in to change notification settings - Fork 619
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
Change termination-time query to instance-action #2199
Change termination-time query to instance-action #2199
Conversation
could you please confirm for what all actions will the time be set? are stop and hibernate the only options? |
the actions are: terminate, stop, and hibernate.
it's not guaranteed that it will be terminated, but it is guaranteed it will be interrupted with one of the above actions. more info here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html |
👍 is there a difference between termination / interruption from ECS point of view? or do we just drain instances? |
from our point of view no, there is no difference, we will drain the instance in any case. |
272aafb
to
be302c5
Compare
This reverts commit 3f4247d.
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 squash/fixup commits before merging
* Add ECS_SPOT_INSTANCE_DRAINING_ENABLED configuration variable (#2180) * Add ECS_SPOT_INSTANCE_DRAINING_ENABLED configuration variable * _ENABLED->ENABLE_ * Added support for automatic spot instance draining. (#2182) * Added Spot termination poller routine * Added unit tests for ECS client: UpdateContainerInstancesState and GetResourceTags * Added unit tests ec2 metadata client: SpotTerminationTime * Added unit tests to agent: isSpotTerminationTimeSet * code review comment updates * use assert library for unit tests * Change termination-time query to instance-action (#2199) * Change termination-time query to instance-action * code review fixups * more code review fixups * refactor tests to be table-driven
Summary
This is an update to #2182
The previous PR only handled the most common type of interruption notice: termination.
But it's possible for users to configure their spot instances to terminate via "stop" or "hibernate", so this PR will handle these types of notices as well.
Implementation details
As explained here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html#using-spot-instances-managing-interruptions, it's possible for spot instances to be interrupted with hibernate or stop actions.
In our implementation, we don't care about which action happened or what time the instance is scheduled to be interrupted. In the same way the termination-time endpoint worked, the instance-action endpoint will 404 until an instance-action has been scheduled (stop, hibernate, or terminate). So once we know that one of these interruptions has been scheduled, we simply set the instance status to DRAINING ASAP.
Testing
unit, integration, manual
New tests cover the changes: yes
Description for the changelog
Added support for automatic spot instance draining.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.