From dec7d3af8c4254570260d6419db1d408b78e82b2 Mon Sep 17 00:00:00 2001 From: Bryan Ellington Date: Mon, 14 Dec 2020 15:39:06 -0500 Subject: [PATCH] Skip cert-manager issuer creation when secrets exist (#41) --- bin/tls-include.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/tls-include.sh b/bin/tls-include.sh index 112cc05a..b41bf1f4 100644 --- a/bin/tls-include.sh +++ b/bin/tls-include.sh @@ -117,15 +117,17 @@ function create_tls_certs { context=$2 shift 2 apps=("$@") - - # Optional TLS Support - deploy_issuers $namespace $context - - # Certs honor USER_DIR for overrides/customizations + + deployedIssuers="false" + # Certs honor USER_DIR for overrides/customizations for app in "${apps[@]}"; do # Only create the secrets if they do not exist TLS_SECRET_NAME=$app-tls-secret if [ -z "$(kubectl get secret -n $namespace $TLS_SECRET_NAME -o name 2>/dev/null)" ]; then + if [ "$deployedIssuers" == "false"]; then + deploy_issuers $namespace $context + deployedIssuers="true" + fi deploy_app_cert "$namespace" "$context" "$app" else log_debug "Using existing $TLS_SECRET_NAME for [$app]"