mirror of
https://github.com/google/nomulus
synced 2025-12-23 06:15:42 +00:00
65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
# This will do rolling restarts of all proxies. This forces the client to reconnect
|
|
# and resets the sessions.
|
|
#
|
|
# To manually trigger a build on GCB, run:
|
|
# gcloud builds submit --config=cloudbuild-restart-proxies.yaml \
|
|
# --substitutions=_ENV=[ENV] ..
|
|
#
|
|
# To trigger a build automatically, follow the instructions below and add a trigger:
|
|
# https://cloud.google.com/cloud-build/docs/running-builds/automate-builds
|
|
#
|
|
# Note: to work around the issue in Spinnaker's 'Deployment Manifest' stage,
|
|
# variable references must avoid the ${var} format. Valid formats include
|
|
# $var or ${"${var}"}. This file uses the former. Since TAG_NAME and _ENV are
|
|
# expanded in the copies sent to Spinnaker, we preserve the brackets around
|
|
# them for safe pattern matching during release.
|
|
# See https://github.com/spinnaker/spinnaker/issues/3028 for more information.
|
|
steps:
|
|
# Pull the credential for nomulus tool.
|
|
- name: 'gcr.io/$PROJECT_ID/builder:latest'
|
|
entrypoint: /bin/bash
|
|
args:
|
|
- -c
|
|
- |
|
|
set -e
|
|
gcloud secrets versions access latest \
|
|
--secret nomulus-tool-cloudbuild-credential > tool-credential.json
|
|
# Do rolling restarts of all proxies in all environments.
|
|
- name: 'gcr.io/$PROJECT_ID/builder:latest'
|
|
entrypoint: /bin/bash
|
|
args:
|
|
- -c
|
|
- |
|
|
if [ ${_ENV} == production ]
|
|
then
|
|
project_id="domain-registry"
|
|
else
|
|
project_id="domain-registry-${_ENV}"
|
|
fi
|
|
|
|
gcloud auth activate-service-account --key-file=tool-credential.json
|
|
|
|
first=true
|
|
t=0
|
|
|
|
while read line
|
|
do
|
|
# Sleep for t seconds for the rollout to stabilize.
|
|
if [[ -v first ]]
|
|
then
|
|
unset first
|
|
else
|
|
sleep $t
|
|
fi
|
|
name=$(echo $line | awk '{print $1}')
|
|
location=$(echo $line | awk '{print $2}')
|
|
echo $name $region
|
|
echo "Updating cluster $name in location $location..."
|
|
gcloud container clusters get-credentials $name \
|
|
--project $project_id --location $location
|
|
kubectl rollout restart deployment/proxy-deployment
|
|
done < <(gcloud container clusters list --project $project_id | grep proxy-cluster)
|
|
timeout: 7500s
|
|
options:
|
|
machineType: 'N1_HIGHCPU_8'
|