1
0
Fork 0
hscloud/cluster/tools/calicoctl.sh

23 lines
763 B
Bash
Raw Normal View History

2019-01-18 00:34:20 +00:00
#!/usr/bin/env bash
# A wrapper around the real calicoctl to configure etcd access.
2019-01-18 00:34:20 +00:00
source tools/hscloud/lib.sh || exit 1
2019-01-18 00:34:20 +00:00
function main() {
local ws=$(hscloud::workspace_location)
2019-01-18 00:34:20 +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 00:34:20 +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
"$(hscloud::must_rlocation calicoctl_3_15/file/calicoctl)" "$@"
}
main "$@"