From 980e7d0c23024943d3fbb230e527a6f70a1b1311 Mon Sep 17 00:00:00 2001 From: MPetrenk Date: Wed, 10 Aug 2022 13:29:30 +0300 Subject: [PATCH 1/4] add namespace existing check --- modules/osdu/scripts/install_asm.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/osdu/scripts/install_asm.sh b/modules/osdu/scripts/install_asm.sh index 6d76f743..4b605ab0 100755 --- a/modules/osdu/scripts/install_asm.sh +++ b/modules/osdu/scripts/install_asm.sh @@ -9,8 +9,6 @@ OUTDIR=${4} GATEWAY=istio-gateway PROJECT_NUMBER=$(gcloud projects describe "${PROJECT_ID}" --format="value(projectNumber)") -kubectl create ns $GATEWAY - gcloud services enable mesh.googleapis.com --project="${PROJECT_ID}" gcloud container fleet mesh enable --project="${PROJECT_ID}" gcloud container fleet memberships register "${CLUSTER_NAME}" --gke-cluster="${CLUSTER_LOCATION}"/"${CLUSTER_NAME}" --enable-workload-identity --project "${PROJECT_ID}" @@ -18,6 +16,14 @@ gcloud container clusters update "${CLUSTER_NAME}" --zone "${CLUSTER_LOCATION}" gcloud container fleet mesh update --control-plane automatic --memberships "${CLUSTER_NAME}" --project "${PROJECT_ID}" sleep 60 +CHECK_NS=$(kubectl get ns ${GATEWAY} --ignore-not-found) +if [[ "${CHECK_NS}" ]] +then + echo "$GATEWAY namespace exists" +else + kubectl create ns $GATEWAY +fi + echo "Downloading configuration files for gateways" if [[ -d "${OUTDIR}" ]] then -- GitLab From 6625ac34a372ba616a7681bd476dbe473ad7a8ef Mon Sep 17 00:00:00 2001 From: MPetrenk Date: Fri, 12 Aug 2022 10:50:45 +0300 Subject: [PATCH 2/4] remove namespace creation --- modules/osdu/scripts/install_asm.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/osdu/scripts/install_asm.sh b/modules/osdu/scripts/install_asm.sh index 4b605ab0..bd7b8c38 100755 --- a/modules/osdu/scripts/install_asm.sh +++ b/modules/osdu/scripts/install_asm.sh @@ -16,14 +16,6 @@ gcloud container clusters update "${CLUSTER_NAME}" --zone "${CLUSTER_LOCATION}" gcloud container fleet mesh update --control-plane automatic --memberships "${CLUSTER_NAME}" --project "${PROJECT_ID}" sleep 60 -CHECK_NS=$(kubectl get ns ${GATEWAY} --ignore-not-found) -if [[ "${CHECK_NS}" ]] -then - echo "$GATEWAY namespace exists" -else - kubectl create ns $GATEWAY -fi - echo "Downloading configuration files for gateways" if [[ -d "${OUTDIR}" ]] then -- GitLab From 434544630741582abee9a7c2b184457f8f84b9e4 Mon Sep 17 00:00:00 2001 From: MPetrenk Date: Fri, 12 Aug 2022 10:51:47 +0300 Subject: [PATCH 3/4] add namespace resource --- modules/osdu/https.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/osdu/https.tf b/modules/osdu/https.tf index 13f79b43..4ed4a1b0 100644 --- a/modules/osdu/https.tf +++ b/modules/osdu/https.tf @@ -35,6 +35,13 @@ resource "local_file" "backend-config" { filename = "./manifests/backend-config.yaml" } +resource "kubernetes_namespace" "namespace" { + depends_on = [google_container_cluster.primary] + metadata { + name = "istio-gateway" + } +} + module "kubectl" { source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper" module_depends_on = [google_container_cluster.primary] -- GitLab From 7264bed8d27530254263f821633a11086c6c85df Mon Sep 17 00:00:00 2001 From: MPetrenk Date: Fri, 12 Aug 2022 16:16:47 +0300 Subject: [PATCH 4/4] add namespace create corrections --- modules/osdu/https.tf | 7 ------- modules/osdu/scripts/install_asm.sh | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/osdu/https.tf b/modules/osdu/https.tf index 4ed4a1b0..13f79b43 100644 --- a/modules/osdu/https.tf +++ b/modules/osdu/https.tf @@ -35,13 +35,6 @@ resource "local_file" "backend-config" { filename = "./manifests/backend-config.yaml" } -resource "kubernetes_namespace" "namespace" { - depends_on = [google_container_cluster.primary] - metadata { - name = "istio-gateway" - } -} - module "kubectl" { source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper" module_depends_on = [google_container_cluster.primary] diff --git a/modules/osdu/scripts/install_asm.sh b/modules/osdu/scripts/install_asm.sh index bd7b8c38..4b605ab0 100755 --- a/modules/osdu/scripts/install_asm.sh +++ b/modules/osdu/scripts/install_asm.sh @@ -16,6 +16,14 @@ gcloud container clusters update "${CLUSTER_NAME}" --zone "${CLUSTER_LOCATION}" gcloud container fleet mesh update --control-plane automatic --memberships "${CLUSTER_NAME}" --project "${PROJECT_ID}" sleep 60 +CHECK_NS=$(kubectl get ns ${GATEWAY} --ignore-not-found) +if [[ "${CHECK_NS}" ]] +then + echo "$GATEWAY namespace exists" +else + kubectl create ns $GATEWAY +fi + echo "Downloading configuration files for gateways" if [[ -d "${OUTDIR}" ]] then -- GitLab