From 028487c55a02ffa5fe39cbcfa6984007bf064fe5 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Wed, 21 Feb 2024 15:48:00 +0000 Subject: [PATCH] Ensure teleport cache directory is symlink Signed-off-by: Marcus Noble --- home/.bin/gs-login | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home/.bin/gs-login b/home/.bin/gs-login index 129f845..5101ea3 100755 --- a/home/.bin/gs-login +++ b/home/.bin/gs-login @@ -71,6 +71,12 @@ case ${#POS_ARGS[@]} in opsctl login ${DEBUG} ${POS_ARGS[@]} else echo "Logging in with Teleport. Cluster: '${TELEPORT_CLUSTER_NAME}'" + # Make sure that caching is disabled to avoid issues with cross-cluster cache pollution + TELEPORT_CACHE_DIR="${HOME}/.kube/cache/discovery/teleport.giantswarm.io_443" + if [[ "$(readlink -f ${TELEPORT_CACHE_DIR})" != "/dev/null" ]]; then + rm -rf ${TELEPORT_CACHE_DIR} + ln -s /dev/null ${TELEPORT_CACHE_DIR} + fi tsh kube login ${TELEPORT_CLUSTER_NAME} fi ;;