Skip to content

Commit

Permalink
updates deployements
Browse files Browse the repository at this point in the history
  • Loading branch information
kundan59 committed Sep 13, 2023
1 parent 0b3e1cf commit dc65989
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 49 deletions.
9 changes: 5 additions & 4 deletions apps-deployment-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
53 changes: 10 additions & 43 deletions deployment/gcpresources/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}


0 comments on commit dc65989

Please sign in to comment.