Delete leader node first

This commit is contained in:
Michael Vines 2018-09-07 08:56:43 -07:00
parent a2631e89f6
commit dcb30a8489
1 changed files with 12 additions and 6 deletions

View File

@ -187,13 +187,19 @@ case $command in
delete) delete)
$metricsWriteDatapoint "testnet-deploy net-delete-begin=1" $metricsWriteDatapoint "testnet-deploy net-delete-begin=1"
gcloud_FindInstances "name~^$prefix-" # Delete the leader node first to prevent unusual metrics on the dashboard
# during shutdown.
# TODO: It would be better to fully cut-off metrics reporting before any
# instances are deleted.
for filter in "^$prefix-leader" "^$prefix-"; do
gcloud_FindInstances "name~$filter"
if [[ ${#instances[@]} -eq 0 ]]; then if [[ ${#instances[@]} -eq 0 ]]; then
echo "No instances found matching '^$prefix-'" echo "No instances found matching '$filter'"
else else
gcloud_DeleteInstances "$yes" gcloud_DeleteInstances "$yes"
fi fi
done
rm -f "$configFile" rm -f "$configFile"
$metricsWriteDatapoint "testnet-deploy net-delete-complete=1" $metricsWriteDatapoint "testnet-deploy net-delete-complete=1"