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

Commit

Permalink
Using autoscaling instead of ec2 for Termination (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgunapati committed Oct 16, 2019
1 parent 9e175e9 commit 3c2c5ce
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 3c2c5ce

Please sign in to comment.