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

adding option to add extra nodes to each asg #131

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ eks_rolling_update.py -c my-eks-cluster
| ASG_DESIRED_STATE_TAG | Temporary tag which will be saved to the ASG to store the state of the EKS cluster prior to update | eks-rolling-update:desired_capacity |
| ASG_ORIG_CAPACITY_TAG | Temporary tag which will be saved to the ASG to store the state of the EKS cluster prior to update | eks-rolling-update:original_capacity |
| ASG_ORIG_MAX_CAPACITY_TAG | Temporary tag which will be saved to the ASG to store the state of the EKS cluster prior to update | eks-rolling-update:original_max_capacity |
| ASG_OVERSCALE_INSTANCES | # of Nodes to add to each ASG to account for new pods created in the EKS cluster while cluster autoscaler is disabled | 0 |
| ASG_NAMES | List of space-delimited ASG names. Out of ASGs attached to the cluster, only these will be processed for rolling update. If this is left empty all ASGs of the cluster will be processed. | "" |
| BATCH_SIZE | # of instances to scale the ASG by at a time. When set to 0, batching is disabled. See [Batching](#batching) section | 0 |
| MAX_ALLOWABLE_NODE_AGE | The max age each node allowed to be. This works with `RUN_MODE` 4 as node rolling is updating based on age of node | 6 |
Expand Down
3 changes: 1 addition & 2 deletions eksrollup/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ def validate_cluster_health(asg_name, new_desired_asg_capacity, cluster_name, pr
logger.info(f'Exiting since ASG healthcheck failed after {cluster_health_retry} attempts')
raise Exception('ASG healthcheck failed')


def scale_up_asg(cluster_name, asg, count):
asg_old_max_size = asg['MaxSize']
asg_old_desired_capacity = asg['DesiredCapacity']
asg_old_desired_capacity = asg['DesiredCapacity'] + app_config['ASG_OVERSCALE_INSTANCES']
desired_capacity = asg_old_desired_capacity + count
asg_tags = asg['Tags']
asg_name = asg['AutoScalingGroupName']
Expand Down
1 change: 1 addition & 0 deletions eksrollup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def str_to_bool(val):
'ASG_ORIG_CAPACITY_TAG': os.getenv('ASG_ORIG_CAPACITY_TAG', 'eks-rolling-update:original_capacity'),
'ASG_ORIG_MAX_CAPACITY_TAG': os.getenv('ASG_ORIG_MAX_CAPACITY_TAG', 'eks-rolling-update:original_max_capacity'),
'ASG_USE_TERMINATION_POLICY': str_to_bool(os.getenv('ASG_USE_TERMINATION_POLICY', False)),
'ASG_OVERSCALE_INSTANCES': int(os.getenv('ASG_OVERSCALE_INSTANCES', 0)),
'INSTANCE_WAIT_FOR_STOPPING': str_to_bool(os.getenv('INSTANCE_WAIT_FOR_STOPPING', False)),
'CLUSTER_HEALTH_WAIT': int(os.getenv('CLUSTER_HEALTH_WAIT', 90)),
'CLUSTER_HEALTH_RETRY': int(os.getenv('CLUSTER_HEALTH_RETRY', 1)),
Expand Down