2019-01-18 01:34:20 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-10-16 20:53:51 +00:00
|
|
|
# A wrapper around the real calicoctl to configure etcd access.
|
2019-01-18 01:34:20 +01:00
|
|
|
|
2021-10-16 20:53:51 +00:00
|
|
|
source tools/hscloud/lib.sh || exit 1
|
2019-01-18 01:34:20 +01:00
|
|
|
|
2021-10-16 20:53:51 +00:00
|
|
|
function main() {
|
|
|
|
local ws=$(hscloud::workspace_location)
|
2019-01-18 01:34:20 +01:00
|
|
|
|
2021-10-16 20:53:51 +00:00
|
|
|
export ETCD_ENDPOINTS="https://bc01n01.hswaw.net:2379,https://bc01n01.hswaw.net:2379,https://bc01n01.hswaw.net:2379"
|
|
|
|
export ETCD_KEY_FILE="$ws/cluster/secrets/plain/etcd-calico.key"
|
|
|
|
export ETCD_CERT_FILE="$ws/cluster/certs/etcd-calico.cert"
|
|
|
|
export ETCD_CA_CERT_FILE="$ws/cluster/certs/ca-etcd.crt"
|
2019-01-18 01:34:20 +01:00
|
|
|
|
2021-10-16 20:53:51 +00:00
|
|
|
if [ ! -f "$ETCD_KEY_FILE" ] ; then
|
|
|
|
$(hscloud::must_rlocation hscloud/tools/secretstore) decrypt "$ws/cluster/secrets/cipher/etcd-calico.key" "$ETCD_KEY_FILE"
|
|
|
|
fi
|
|
|
|
|
2021-06-18 13:12:41 +02:00
|
|
|
"$(hscloud::must_rlocation calicoctl_3_15/file/calicoctl)" "$@"
|
2021-10-16 20:53:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|