From b042f6512eee9747076e2e611f182320df560095 Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Mon, 18 Sep 2023 14:56:20 +1000 Subject: [PATCH] fix: create namespace if it is not created yet Signed-off-by: Lenin Mehedy --- dev/scripts/env.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dev/scripts/env.sh b/dev/scripts/env.sh index 3d1be7dda..81838d7d4 100644 --- a/dev/scripts/env.sh +++ b/dev/scripts/env.sh @@ -29,8 +29,6 @@ function setup_temp_dir() { echo "File list in ${TMP_DIR}" ls -la "${TMP_DIR}" fi - - cat "${TMP_DIR}/.env" } function load_env_file() { @@ -47,6 +45,11 @@ function setup_kubectl_context() { [[ -z "${CLUSTER_NAME}" ]] && echo "ERROR: Cluster name is required" && return 1 [[ -z "${NAMESPACE}" ]] && echo "ERROR: Namespace name is required" && return 1 + kubectl get ns "${NAMESPACE}" &>/dev/null + if [[ $? -ne 0 ]]; then + kubectl create ns "${NAMESPACE}" + fi + echo "List of namespaces:" kubectl get ns