From 0b57340c2af55780b800ef9d7b1deeb4afdac5be Mon Sep 17 00:00:00 2001 From: abidknashtech Date: Thu, 16 Nov 2023 13:11:07 +0530 Subject: [PATCH] added GCP json key in Github pipline --- .github/workflows/car-demo-pipeline.yml | 3 ++- deployment/gcpresources/terraform/main.tf | 2 +- inventory-service/gcp-deploy-service.yaml | 9 --------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/car-demo-pipeline.yml b/.github/workflows/car-demo-pipeline.yml index 2a73e04d..b747e748 100644 --- a/.github/workflows/car-demo-pipeline.yml +++ b/.github/workflows/car-demo-pipeline.yml @@ -24,7 +24,7 @@ jobs: settings-path: ${{ github.workspace }} - uses: 'google-github-actions/auth@v1' with: - credentials_json: '${{ secrets.GKE_KEY }}' + credentials_json: ${{ secrets.GKE_KEY }} - uses: google-github-actions/setup-gcloud@v1 with: project_id: ${{ env.GKE_PROJECT }} @@ -40,3 +40,4 @@ jobs: . apps-deployment-script.sh "us-east1" env: GITHUB_TOKEN: ${{ github.token }} + APPLICATION_CREDENTIALS: ${{ secrets.GKE_KEY }} diff --git a/deployment/gcpresources/terraform/main.tf b/deployment/gcpresources/terraform/main.tf index f1ec1974..39192329 100644 --- a/deployment/gcpresources/terraform/main.tf +++ b/deployment/gcpresources/terraform/main.tf @@ -162,5 +162,5 @@ resource "google_secret_manager_secret" "car-demo-secret" { resource "google_secret_manager_secret_version" "car-demo-secret-1" { secret = google_secret_manager_secret.car-demo-secret.id - secret_data = "{\"mysql-db-username\": \"${var.user_name}\", \"mysql-db-userpassword\": \"${var.user_password}\", \"gcp-json-key\": \"${file("key.json")}\"}" + secret_data = "{\"mysql-db-username\": \"${var.user_name}\", \"mysql-db-userpassword\": \"${var.user_password}\"}" } diff --git a/inventory-service/gcp-deploy-service.yaml b/inventory-service/gcp-deploy-service.yaml index bf714c54..53caf70e 100644 --- a/inventory-service/gcp-deploy-service.yaml +++ b/inventory-service/gcp-deploy-service.yaml @@ -14,10 +14,6 @@ spec: labels: app: inventoryservice spec: - volumes: - - name: google-cloud-key - secret: - secretName: pubsub-key containers: - name: inventoryservice image: gcr.io/PROJECT_ID/IMAGE:TAG @@ -26,9 +22,6 @@ spec: - name: http containerPort: 9091 protocol: TCP - volumeMounts: - - name: google-cloud-key - mountPath: /var/secrets/google env: - name: MYSQL_DB_USERNAME valueFrom: @@ -42,8 +35,6 @@ spec: name: secret-to-be-created key: mysql-db-userpassword optional: false - - name: GOOGLE_APPLICATION_CREDENTIALS - value: /var/secrets/google/key.json envFrom: - configMapRef: name: inventory-configmap