Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 30 lines (25 sloc) 790 Bytes
#!/bin/bash
set -euo pipefail
. ../config/env
# It's safe to disable HostKeyChecking since we use no password and the input
# isn't secret
SSH="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
tf_upgrade() {
local i=$1
shift
# FIXME: This should probably use a systemd target
if [[ -z "${SKIP_SHUTDOWN:-}" ]]; then
$SSH "root@edge$i.$DOMAIN" "kubectl drain master$i && systemctl stop 'k8s*' etcd tinc@default"
$SSH "root@edge$i.$DOMAIN" "shutdown -h now" || true # shutdown kills ssh, so ignoring error
fi
./terraform "$@" \
-target "digitalocean_droplet.master[$i]" \
-target "digitalocean_record.master_a[$i]"
}
if [[ -n "${LIMIT:-}" ]]; then
tf_upgrade "${LIMIT}" "$@"
exit 0
fi
for ((i=0;i<SERVERS;i++)); do
tf_upgrade $i "$@"
done