Skip to content

Commit

Permalink
check for az rebalance disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
knguyen100000010 committed Jun 4, 2024
1 parent 57b4021 commit 4db657c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ <h4 class="modal-title">Resume Confirm</h4>
</div>
{% endif %}

{% if True %}
{% if "AZRebalance" in asg_suspended_processes %}
<div class="alert alert-warning alert-dismissible">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
Your cluster is <strong>not</strong> enabled for automatic AZ rebalancing. If your service is stateless, consider enabling it <a href="/groups/{{ env.envName }}-{{ env.stageName }}/config" target="_blank">here</a>.
Expand Down
11 changes: 11 additions & 0 deletions deploy-board/deploy_board/webapp/env_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ def get(self, request, name, stage=None):

cluster_refresh_suggestion_for_golden_ami = _gen_message_for_refreshing_cluster(request, last_cluster_refresh_status, latest_succeeded_base_image_update_event, env)

asg_suspended_processes = _get_asg_suspended_processes(request, env) or []

if not env['deployId']:
capacity_hosts = deploys_helper.get_missing_hosts(request, name, stage)
provisioning_hosts = environ_hosts_helper.get_hosts(request, name, stage)
Expand Down Expand Up @@ -484,6 +486,7 @@ def get(self, request, name, stage=None):
"subAccount": AWS_SUB_ACCOUNT,
"accounts": accounts,
"pindeploy_config": pindeploy_config,
"asg_suspended_processes": asg_suspended_processes,
})
showMode = 'complete'
account = 'all'
Expand Down Expand Up @@ -575,6 +578,7 @@ def get(self, request, name, stage=None):
"subAccount": AWS_SUB_ACCOUNT,
"accounts": accounts,
"pindeploy_config": pindeploy_config,
"asg_suspended_processes": asg_suspended_processes,
}
response = render(request, 'environs/env_landing.html', context)

Expand All @@ -586,6 +590,13 @@ def get(self, request, name, stage=None):

return response

def _get_asg_suspended_processes(request, env):
try:
cluster_name = get_cluster_name(request, env.get('envName'), env.get('stageName'), env=env)
return autoscaling_groups_helper.get_disabled_asg_actions(request, cluster_name)
except:
return None

def _gen_message_for_refreshing_cluster(request, last_cluster_refresh_status, latest_succeeded_base_image_update_event, env):
try:
group_name = get_group_name(request, env.get('envName'), env.get('stageName'), env=env)
Expand Down

0 comments on commit 4db657c

Please sign in to comment.