diff --git a/README.md b/README.md index 7e742b1..92fc9e2 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/eksrollup/cli.py b/eksrollup/cli.py index 0a599b5..bdc1807 100755 --- a/eksrollup/cli.py +++ b/eksrollup/cli.py @@ -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'] diff --git a/eksrollup/config.py b/eksrollup/config.py index 0e8029a..88d12d1 100644 --- a/eksrollup/config.py +++ b/eksrollup/config.py @@ -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)),