1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "$1" == "" ]; then
echo "Usage $0: <config-file>"
exit 1
fi
source ${DIR}/util.sh
source ${DIR}/config.sh $1
GCLOUD="gcloud"
Header "Updating mirror instances..."
i=0
while [ $i -lt ${MIRROR_NUM_REPLICAS} ]; do
echo "Updating ${MIRROR_MACHINES[${i}]}"
echo "${MIRROR_META[${i}]}" > /tmp/metadata.${i}
if ! gcloud compute instances add-metadata \
${MIRROR_MACHINES[${i}]} \
--zone ${MIRROR_ZONES[${i}]} \
--metadata-from-file google-container-manifest=/tmp/metadata.${i}; then
echo "Retrying"
continue
fi
if ! gcloud compute ssh ${MIRROR_MACHINES[${i}]} \
--zone ${MIRROR_ZONES[${i}]} \
--command \
'sudo docker pull gcr.io/'${PROJECT}'/super_mirror:test &&
sudo docker kill $(sudo docker ps | grep super_mirror | awk -- "{print \$1}" )'; then
echo "Retrying"
continue
fi
WaitHttpStatus ${MIRROR_MACHINES[${i}]} ${MIRROR_ZONES[${i}]} /ct/v1/get-sth 200
i=$(($i + 1))
done;
|