From b0eb787f33249e2f4f7bc897c9e499be52b5e698 Mon Sep 17 00:00:00 2001
From: Muhammad Raihan Akbar <ianakbar711@gmail.com>
Date: Wed, 26 Feb 2025 23:34:20 +0700
Subject: [PATCH] [REFACTOR] reconfigured yaml file to differentiate prod and
 staging

---
 .github/workflows/staging-ci-cd.yml |  4 ++--
 resources.yaml => production.yaml   |  2 +-
 staging.yaml                        | 34 +++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 3 deletions(-)
 rename resources.yaml => production.yaml (84%)
 create mode 100644 staging.yaml

diff --git a/.github/workflows/staging-ci-cd.yml b/.github/workflows/staging-ci-cd.yml
index 0c52350..b9f2245 100644
--- a/.github/workflows/staging-ci-cd.yml
+++ b/.github/workflows/staging-ci-cd.yml
@@ -74,5 +74,5 @@ jobs:
           GOOGLE_REPOSiTORY: staging-repository
         run: |
           gcloud container clusters get-credentials safetypin-staging --region asia-southeast2
-          sed -i "s/GOOGLE_PROJECT/$GOOGLE_PROJECT/g" resources.yaml
-          kubectl apply -f resources.yaml
\ No newline at end of file
+          sed -i "s/GOOGLE_PROJECT/$GOOGLE_PROJECT/g" staging.yaml
+          kubectl apply -f staging.yaml
\ No newline at end of file
diff --git a/resources.yaml b/production.yaml
similarity index 84%
rename from resources.yaml
rename to production.yaml
index f9611f7..a3d64c5 100644
--- a/resources.yaml
+++ b/production.yaml
@@ -29,6 +29,6 @@ spec:
     spec:
       containers:
         - name: authentication
-          image: us-central1-docker.pkg.dev/GOOGLE_PROJECT/GOOGLE_REPOSITORY/authentication:latest
+          image: us-central1-docker.pkg.dev/GOOGLE_PROJECT/my-repository/authentication:latest
           ports:
             - containerPort: 8080
\ No newline at end of file
diff --git a/staging.yaml b/staging.yaml
new file mode 100644
index 0000000..91457e7
--- /dev/null
+++ b/staging.yaml
@@ -0,0 +1,34 @@
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: authentication
+spec:
+  type: LoadBalancer
+  selector:
+    app: authentication
+  ports:
+    - port: 80
+      targetPort: 8080
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: authentication
+  labels:
+    app: authentication
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: authentication
+  template:
+    metadata:
+      labels:
+        app: authentication
+    spec:
+      containers:
+        - name: authentication
+          image: us-central1-docker.pkg.dev/GOOGLE_PROJECT/staging-repository/authentication:latest
+          ports:
+            - containerPort: 8080
\ No newline at end of file
-- 
GitLab