Sergiusz Bazanski | a305bc9 | 2019-01-18 01:34:20 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Serge Bazanski | 0f8e5a2 | 2021-10-16 20:53:51 +0000 | [diff] [blame] | 3 | # A wrapper around the real calicoctl to configure etcd access. |
Sergiusz Bazanski | a305bc9 | 2019-01-18 01:34:20 +0100 | [diff] [blame] | 4 | |
Serge Bazanski | 0f8e5a2 | 2021-10-16 20:53:51 +0000 | [diff] [blame] | 5 | source tools/hscloud/lib.sh || exit 1 |
Sergiusz Bazanski | a305bc9 | 2019-01-18 01:34:20 +0100 | [diff] [blame] | 6 | |
Serge Bazanski | 0f8e5a2 | 2021-10-16 20:53:51 +0000 | [diff] [blame] | 7 | function main() { |
| 8 | local ws=$(hscloud::workspace_location) |
Sergiusz Bazanski | a305bc9 | 2019-01-18 01:34:20 +0100 | [diff] [blame] | 9 | |
Serge Bazanski | 0f8e5a2 | 2021-10-16 20:53:51 +0000 | [diff] [blame] | 10 | 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 Bazanski | a305bc9 | 2019-01-18 01:34:20 +0100 | [diff] [blame] | 14 | |
Serge Bazanski | 0f8e5a2 | 2021-10-16 20:53:51 +0000 | [diff] [blame] | 15 | 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 | |
| 22 | main "$@" |