From e034fbb4ab6b5099a51f72e633fa29efc7bd7992 Mon Sep 17 00:00:00 2001 From: Marco Aurelio Caldas Miranda <17923899+macmiranda@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:00:16 +0100 Subject: [PATCH] Revert "Moved namespace creation to helm flag" This reverts commit 53ce67e0d6f84455f7ea7a512238c63f381e15a1. --- deploy.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index efeabe2..b26b407 100644 --- a/deploy.sh +++ b/deploy.sh @@ -46,6 +46,16 @@ else update-kubeconfig --name ${CLUSTER_NAME} fi +# Check if namespace exists and create it if it doesn't. +KUBE_NAMESPACE_EXISTS=$(kubectl get namespaces | _grep ^${DEPLOY_NAMESPACE}) +if [ -z "${KUBE_NAMESPACE_EXISTS}" ]; then + echo "The namespace ${DEPLOY_NAMESPACE} does not exists. Creating..." + kubectl create namespace "${DEPLOY_NAMESPACE}" +else + echo "The namespace ${DEPLOY_NAMESPACE} exists. Skipping creation..." +fi + + # If defined, will set up authentication parameters if [ "${HELM_ACTION}" == "install" ] && [ "${OCI_REGISTRY}" != "true" ]; then @@ -125,7 +135,7 @@ fi if [ "${HELM_ACTION}" == "install" ]; then # Upgrade or install the chart. This does it all. - HELM_COMMAND="helm upgrade --install --create-namespace --timeout ${TIMEOUT} ${HELM_AUTH}" + HELM_COMMAND="helm upgrade --install --timeout ${TIMEOUT} ${HELM_AUTH}" # If we should wait, then do so if [ -n "${HELM_WAIT}" ]; then