summaryrefslogtreecommitdiff
path: root/update_controllers.sh
blob: ad3f95a39456fe7a39e3db6be39807e68655826c (plain)
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
#!/usr/bin/env bash

if [ -z "$1" ]
then
    echo "Usage: $0 <docker_tag> <k8s_namespace>"
    echo "    k8s_namesapce is set to default if not specified"
    exit 1
fi

if [ -z "$2" ]
then
    NAMESPACE=default
else
    NAMESPACE=$2
fi

TAG=$1

CONTROLLERS=`kubectl get pods -o=name --namespace=${NAMESPACE} | grep controller | sed "s/^.\{4\}//" | cut -d '-' -f 2`

for c in ${CONTROLLERS[@]}
do
    kubectl set image deployment --namespace=${NAMESPACE} controller-${c} ztcentral-controller=docker.zerotier.com/zerotier-central/ztcentral-controller:${TAG}
    echo "Sleeping for 1 minute"
    sleep 60
done