blob: 86e1097ece4d5766965a579cdca39bb76d8d70f0 [file] [log] [blame]
Sergiusz Bazanskia305bc92019-01-18 01:34:20 +01001#!/usr/bin/env bash
2
Serge Bazanski0f8e5a22021-10-16 20:53:51 +00003# A wrapper around the real calicoctl to configure etcd access.
Sergiusz Bazanskia305bc92019-01-18 01:34:20 +01004
Serge Bazanski0f8e5a22021-10-16 20:53:51 +00005source tools/hscloud/lib.sh || exit 1
Sergiusz Bazanskia305bc92019-01-18 01:34:20 +01006
Serge Bazanski0f8e5a22021-10-16 20:53:51 +00007function main() {
8 local ws=$(hscloud::workspace_location)
Sergiusz Bazanskia305bc92019-01-18 01:34:20 +01009
Serge Bazanski0f8e5a22021-10-16 20:53:51 +000010 export ETCD_ENDPOINTS="https://bc01n01.hswaw.net:2379,https://bc01n01.hswaw.net:2379,https://bc01n01.hswaw.net:2379"
11 export ETCD_KEY_FILE="$ws/cluster/secrets/plain/etcd-calico.key"
12 export ETCD_CERT_FILE="$ws/cluster/certs/etcd-calico.cert"
13 export ETCD_CA_CERT_FILE="$ws/cluster/certs/ca-etcd.crt"
Sergiusz Bazanskia305bc92019-01-18 01:34:20 +010014
Serge Bazanski0f8e5a22021-10-16 20:53:51 +000015 if [ ! -f "$ETCD_KEY_FILE" ] ; then
16 $(hscloud::must_rlocation hscloud/tools/secretstore) decrypt "$ws/cluster/secrets/cipher/etcd-calico.key" "$ETCD_KEY_FILE"
17 fi
18
19 "$(hscloud::must_rlocation hscloud/cluster/tools/calicoctl.bin)" "$@"
20}
21
22main "$@"