From dc6598998c23144fa1b462bd95ff9da0e9d81000 Mon Sep 17 00:00:00 2001 From: kundan59 Date: Wed, 13 Sep 2023 18:45:29 +0530 Subject: [PATCH] updates deployements --- apps-deployment-script.sh | 9 ++-- deployment/gcpresources/terraform/main.tf | 53 ++++--------------- .../terraform/my-sql-instance-variables.tf | 2 - 3 files changed, 15 insertions(+), 49 deletions(-) diff --git a/apps-deployment-script.sh b/apps-deployment-script.sh index 976ce033..d884ad5f 100644 --- a/apps-deployment-script.sh +++ b/apps-deployment-script.sh @@ -2,6 +2,7 @@ PROJECT_ID="$(gcloud config get-value project)" REGION="$1" +GKE_CLUSTER="car-demo-gke" # install gke-gcloud-auth-plugin to install kubectl and authenticate gke. gcloud --quiet components install gke-gcloud-auth-plugin @@ -46,22 +47,22 @@ do # case 2 build and deploy order-service "order-service") - build_and_deploy_service order-service order-service-gke orderservice + build_and_deploy_service order-service $GKE_CLUSTER orderservice cd ..;; # case 3 build and deploy inventory-service "inventory-service") - build_and_deploy_service inventory-service inventory-service-gke inventoryservice + build_and_deploy_service inventory-service $GKE_CLUSTER inventoryservice cd ..;; # case 4 build and deploy payment-service "payment-service") - build_and_deploy_service payment-service payment-service-gke paymentservice + build_and_deploy_service payment-service $GKE_CLUSTER paymentservice cd ..;; # case 5 build and deploy order-service "shipment-service") - build_and_deploy_service inventory-service inventory-service-gke inventoryservice + build_and_deploy_service inventory-service $GKE_CLUSTER inventoryservice cd ..;; esac diff --git a/deployment/gcpresources/terraform/main.tf b/deployment/gcpresources/terraform/main.tf index b226557e..00d5c8e3 100644 --- a/deployment/gcpresources/terraform/main.tf +++ b/deployment/gcpresources/terraform/main.tf @@ -78,57 +78,24 @@ resource "google_pubsub_topic" "shipment-notification" { } #-----------------------GKE Cluster for applications---------------------------- -resource "google_container_cluster" "order-service-gke" { - name = "order-service-gke" - location = var.gcp_zone_1 - initial_node_count = 1 -} - -resource "google_container_cluster" "inventory-service-gke" { - name = "inventory-service-gke" - location = var.gcp_zone_1 - initial_node_count = 1 -} - -resource "google_container_cluster" "payment-service-gke" { - name = "payment-service-gke" - location = var.gcp_zone_1 - initial_node_count = 1 -} - -resource "google_container_cluster" "shipment-service-gke" { - name = "shipment-service-gke" - location = var.gcp_zone_1 - initial_node_count = 1 -} - -resource "null_resource" "external-secret-order" { - provisioner "local-exec" { - command = "/bin/bash external-secret-gcsm.sh order-service-gke ${var.gcp_zone_1}" +resource "google_container_cluster" "car-demo-gke" { + name = "car-demo-gke" + location = var.gcp_region_1 + ip_allocation_policy { + cluster_ipv4_cidr_block = "" + services_ipv4_cidr_block = "" } - depends_on = [google_container_cluster.order-service-gke] -} + enable_autopilot = true -resource "null_resource" "external-secret-inventory" { - provisioner "local-exec" { - command = "/bin/bash external-secret-gcsm.sh inventory-service-gke ${var.gcp_zone_1}" - } - depends_on = [google_container_cluster.inventory-service-gke] } -resource "null_resource" "external-secret-payment" { +resource "null_resource" "external-secret-car-demo-gke" { provisioner "local-exec" { - command = "/bin/bash external-secret-gcsm.sh payment-service-gke ${var.gcp_zone_1}" + command = "/bin/bash external-secret-gcsm.sh car-demo-gke ${var.gcp_region_1}" } - depends_on = [google_container_cluster.payment-service-gke] + depends_on = [google_container_cluster.car-demo-gke] } -resource "null_resource" "external-secret-shipment" { - provisioner "local-exec" { - command = "/bin/bash external-secret-gcsm.sh shipment-service-gke ${var.gcp_zone_1}" - } - depends_on = [google_container_cluster.shipment-service-gke] -} # use null resources to create my sql tables if needed diff --git a/deployment/gcpresources/terraform/my-sql-instance-variables.tf b/deployment/gcpresources/terraform/my-sql-instance-variables.tf index 66f9b9ec..2afff598 100644 --- a/deployment/gcpresources/terraform/my-sql-instance-variables.tf +++ b/deployment/gcpresources/terraform/my-sql-instance-variables.tf @@ -70,5 +70,3 @@ variable user_password { description = "The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable." default = "JavaDBs#password2023" } - -