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

add warning message to landing page if az rebalance is suspended #1644

Merged
merged 6 commits into from
Jun 7, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ <h4 class="modal-title">Resume Confirm</h4>
</div>
{% endif %}

{% if "AZRebalance" in asg_suspended_processes %}
<div class="alert alert-danger 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>.
Check this <a href="/groups/{{ env.envName }}-{{ env.stageName }}/dist-charts/az/" target="_blank">chart</a> for the current hosts-AZ distribution.
</div>
{% endif %}

{% include "message_banner.tmpl" %}
{% include "environs/env_tabs.tmpl" with envTabKind="deploy" %}
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 @@ -442,6 +442,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 @@ -483,6 +485,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 @@ -574,6 +577,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 @@ -585,6 +589,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 Exception:
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
Loading