Skip to content
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

Ambiguous check of running instances #120

Open
js-timbirkett opened this issue Jan 25, 2022 · 1 comment
Open

Ambiguous check of running instances #120

js-timbirkett opened this issue Jan 25, 2022 · 1 comment

Comments

@js-timbirkett
Copy link
Contributor

if len(actual_instances) != desired_capacity:
logger.info('Asg {} does not have enough running instances to proceed'.format(asg_name))
logger.info('Actual instances: {} Desired instances: {}'.format(
len(actual_instances),
desired_capacity)
)
is_scaled = False
else:
logger.info('Asg {} scaled OK'.format(asg_name))
logger.info('Actual instances: {} Desired instances: {}'.format(
len(actual_instances),
desired_capacity)
)
is_scaled = True
return is_scaled

Causes a failure to run when you have more running instances than desired:

00:04:19.030  2022-01-25 16:24:43,568 INFO     Checking asg golf-dev-mgmt-worker-node-0-20191108085402700900000002 instance count...
00:04:19.030  2022-01-25 16:24:43,701 INFO     Asg golf-dev-mgmt-worker-node-0-20191108085402700900000002 does not have enough running instances to proceed
00:04:19.030  2022-01-25 16:24:43,701 INFO     Actual instances: 7 Desired instances: 6
@crosbymichael1
Copy link
Contributor

Im curious how did you get in the scenario where you have more instances than desired? The change is easy enough to make but Im concerned if saying throw an error only if actual instances is less than desired capacity because 1 maybe the scaling is not working properly and 2 maybe there is left over cordoned instances that have not yet been removing being considered.

Also the description of the function does say matches

"""
Checks that the number of EC2 instances in an ASG matches desired capacity
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants