blob: 5f1390e6d7f7050ed3b878f3f0f01bf8a6d8db57 [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
Bartosz Stebel12f176c2021-06-18 13:12:41 +020019 "$(hscloud::must_rlocation calicoctl_3_15/file/calicoctl)" "$@"
Serge Bazanski0f8e5a22021-10-16 20:53:51 +000020}
21
22main "$@"