-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-use same script for auto-start and stop of aks clusters (#189)
- Loading branch information
1 parent
070987b
commit d0f7525
Showing
5 changed files
with
55 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
shopt -s nocasematch | ||
AMBER='\033[1;33m' | ||
GREEN='\033[0;32m' | ||
source scripts/aks/common-functions.sh | ||
|
||
MODE=${1:-start} | ||
registrySlackWebhook=$2 | ||
SKIP="false" | ||
|
||
if [[ "$MODE" != "start" && "$MODE" != "stop" ]]; then | ||
echo "Invalid MODE. Please use 'start' or 'stop'." | ||
exit 1 | ||
fi | ||
|
||
SUBSCRIPTIONS=$(az account list -o json) | ||
jq -c '.[]' <<< $SUBSCRIPTIONS | while read subscription; do | ||
subscription | ||
jq -c '.[]' <<< $CLUSTERS | while read cluster; do | ||
cluster | ||
cluster_env=$(echo $CLUSTER_NAME | cut -d'-' -f2) | ||
cluster_env=${cluster_env/#sbox/Sandbox} | ||
cluster_env=${cluster_env/stg/Staging} | ||
cluster_business_area=$(echo $CLUSTER_NAME | cut -d'-' -f1) | ||
cluster_business_area=${cluster_business_area/ss/cross-cutting} | ||
if [[ $MODE == "stop" ]]; then | ||
SKIP=$(should_skip_shutdown $cluster_env $cluster_business_area) | ||
fi | ||
if [[ $SKIP == "false" ]]; then | ||
echo -e "${GREEN}About to run $MODE operation on cluster $CLUSTER_NAME (rg:$RESOURCE_GROUP)" | ||
echo az aks $MODE --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --no-wait || echo Ignoring any errors while $MODE operation on cluster | ||
az aks $MODE --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --no-wait || echo Ignoring any errors while $MODE operation on cluster | ||
else | ||
echo -e "${AMBER}cluster $CLUSTER_NAME (rg:$RESOURCE_GROUP) has been skipped from today's $MODE operation schedule" | ||
fi | ||
done | ||
done | ||
|
||
if [[ $MODE == "start" ]]; then | ||
echo "Waiting 10 mins to give clusters time to start before testing pods" | ||
sleep 600 | ||
|
||
jq -c '.[]' <<< $SUBSCRIPTIONS | while read subscription; do | ||
subscription | ||
jq -c '.[]' <<< $CLUSTERS | while read cluster; do | ||
cluster | ||
check_cluster_status | ||
POWER_STATE=$(az aks show --name $CLUSTER_NAME -g $RESOURCE_GROUP | jq -r .powerState.code) | ||
ts_echo "cluster: $CLUSTER_NAME, Power State : ${POWER_STATE}" | ||
done | ||
done | ||
fi |
This file was deleted.
Oops, something went wrong.