Skip to content

Commit 878b27a

Browse files
Merge pull request #33 from tribofustack/chore/update-configmap
Chore/update configmap
2 parents 0985ba7 + 9a02adc commit 878b27a

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

.github/workflows/apply.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
apply:
77
runs-on: ubuntu-latest
88
env:
9-
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CRED }}
9+
GOOGLE_CREDENTIALS: ${{ secrets.CREDENTIALS }}
1010

1111
steps:
1212
- name: Checkout Repo
@@ -15,7 +15,7 @@ jobs:
1515
- name: Auth GCloud
1616
uses: 'google-github-actions/auth@v2.1.2'
1717
with:
18-
credentials_json: ${{ secrets.GOOGLE_CRED }}
18+
credentials_json: ${{ secrets.CREDENTIALS }}
1919
export_environment_variables: true
2020
create_credentials_file: true
2121

@@ -28,11 +28,25 @@ jobs:
2828
- name: Setup Cluster Kubernetes
2929
uses: 'google-github-actions/get-gke-credentials@v2'
3030
with:
31-
cluster_name: ${{ vars.CLUSTER }}
31+
cluster_name: ${{ vars.CLUSTER_NAME }}
3232
location: ${{ vars.ZONE }}
3333

3434
- name: Setup Namespace
3535
run: kubectl config set-context --current --namespace=orderly
3636

37+
- name: Create ConfigMap
38+
working-directory: k8s/
39+
run: |
40+
echo "$(cat api-configmap.yaml)" | envsubst | kubectl apply -f -
41+
env:
42+
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
43+
DB_IP: ${{ vars.DB_IP }}
44+
DB_USERNAME: ${{ vars.DB_USERNAME }}
45+
DB_NAME: ${{ vars.DB_NAME }}
46+
47+
3748
- name: apply api
38-
run: kubectl apply -f k8s/
49+
run: |
50+
kubectl apply -f k8s/api-deployment.yaml
51+
kubectl apply -f k8s/api-hpa.yaml
52+
kubectl apply -f k8s/api-service.yaml

.github/workflows/destroy.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
destroy:
77
runs-on: ubuntu-latest
88
env:
9-
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CRED }}
9+
GOOGLE_CREDENTIALS: ${{ secrets.CREDENTIALS }}
1010

1111
steps:
1212
- name: Checkout Repo
@@ -15,7 +15,7 @@ jobs:
1515
- name: Auth GCloud
1616
uses: 'google-github-actions/auth@v2.1.2'
1717
with:
18-
credentials_json: ${{ secrets.GOOGLE_CRED }}
18+
credentials_json: ${{ secrets.CREDENTIALS }}
1919
export_environment_variables: true
2020
create_credentials_file: true
2121

@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Cluster Kubernetes
2626
uses: 'google-github-actions/get-gke-credentials@v2'
2727
with:
28-
cluster_name: ${{ vars.CLUSTER }}
28+
cluster_name: ${{ vars.CLUSTER_NAME }}
2929
location: ${{ vars.ZONE }}
3030

3131
- name: Setup Namespace

k8s/api-configmap.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ metadata:
55
data:
66
PORT: "3000"
77
NODE_ENV: "production"
8-
DB_HOST: "34.31.179.110" # db-service
9-
DB_USERNAME: "postgres-user" # "postgres"
8+
DB_HOST: "${DB_IP}" # db-service
9+
DB_USERNAME: "${DB_USERNAME}" # "postgres"
1010
DB_PORT: "5432"
11-
DB_PASSWORD: "postgres-pass" # "postgres"
12-
DB_NAME: "orderly-db" # postgres
11+
DB_PASSWORD: "${DB_PASSWORD}" # "postgres"
12+
DB_NAME: "${DB_NAME}" # postgres
1313
DB_DIALECT: postgres
1414
CACHE_HOST: cache-service
1515
CACHE_PORT: "6379"

0 commit comments

Comments
 (0)