Added support for Teleport to gs-login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
4bd7292f23
commit
625aa58ce9
@ -62,6 +62,16 @@ case ${#POS_ARGS[@]} in
|
||||
;;
|
||||
*)
|
||||
kubectl config delete-context gs-${POS_ARGS[0]} &>/dev/null
|
||||
opsctl login ${DEBUG} ${POS_ARGS[@]}
|
||||
|
||||
TELEPORT_CLUSTER_NAME="$(echo "${POS_ARGS[@]}" | tr ' ' '-')"
|
||||
TELEPORT_SUPPORTED=$(tsh kube ls -f json --query "name == \"${TELEPORT_CLUSTER_NAME}\"" 2>/dev/null | jq '. | length')
|
||||
if [ ${TELEPORT_SUPPORTED} -eq 0 ]; then
|
||||
# Teleport not supported, old style login
|
||||
echo "Cluster isn't know to Teleport, using old login method"
|
||||
opsctl login ${DEBUG} ${POS_ARGS[@]}
|
||||
else
|
||||
echo "Logging in with Teleport. Cluster: '${TELEPORT_CLUSTER_NAME}'"
|
||||
tsh kube login ${TELEPORT_CLUSTER_NAME}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user