ZeroTierOne/update_controllers.sh

27 lines
608 B
Bash
Raw Normal View History

#!/usr/bin/env bash
if [ -z "$1" ]
then
2019-02-08 18:40:57 +00:00
echo "Usage: $0 <docker_tag> <k8s_namespace>"
echo " k8s_namesapce is set to default if not specified"
exit 1
fi
2019-02-08 18:40:57 +00:00
if [ -z "$2" ]
then
NAMESPACE=default
else
NAMESPACE=$2
fi
TAG=$1
2019-02-08 18:40:57 +00:00
CONTROLLERS=`kubectl get pods -o=name --namespace=${NAMESPACE} | grep controller | sed "s/^.\{4\}//" | cut -d '-' -f 2`
for c in ${CONTROLLERS[@]}
do
2019-02-08 18:40:57 +00:00
kubectl set image deployment --namespace=${NAMESPACE} controller-${c} ztcentral-controller=docker.zerotier.com/zerotier-central/ztcentral-controller:${TAG}
2018-12-07 23:17:12 +00:00
echo "Sleeping for 1 minute"
sleep 60
done