Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Using autoscaling instead of ec2 for Termination #53

Merged
merged 1 commit into from
Oct 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cloud_provider/aws/aws_minion_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,13 @@ def run_or_die(self, instance, asg_meta, asg_semaphore):

# Cordon and drain the node first
self.cordon_node(instance)

self._ec2_client.terminate_instances(InstanceIds=[instance.InstanceId])

# Terminate EC2 uisng autoscaling client
self._ac_client.terminate_instance_in_auto_scaling_group(InstanceId=instance.InstanceId,
ShouldDecrementDesiredCapacity=False)
logger.info("Terminated instance %s", instance.InstanceId)
asg_meta.remove_instance(instance.InstanceId)
logger.info("Removed instance %s from ASG %s", instance.InstanceId,asg_meta.get_name())
logger.info("Removed instance %s from ASG %s", instance.InstanceId, asg_meta.get_name())
logger.info("Sleeping 180s before checking ASG")
time.sleep(180)
self.wait_for_all_running(asg_meta)
Expand Down