diff --git a/add-cluster/add-cluster.sh b/add-cluster/add-cluster.sh index edfdf5b1..17cb58cc 100755 --- a/add-cluster/add-cluster.sh +++ b/add-cluster/add-cluster.sh @@ -8,6 +8,31 @@ # ANNOTATIONS (cm - optional) # CSDP_TOKEN_SECRET +SECRET_NAME="" + +function get_service_account_secret_name() { + SECRET_NAME=$(kubectl get ServiceAccount ${SERVICE_ACCOUNT_NAME} -n ${NAMESPACE} -o jsonpath='{.secrets[0].name}') + if [[ -z ${SECRET_NAME} ]]; then + echo "Creating new ServiceAccount token" + # create secret for service account + SECRET_NAME=$(kubectl create -f - <