Skip to content

Commit

Permalink
Stop using manual secrets, plus secret and variable cleanup (#74)
Browse files Browse the repository at this point in the history
* Add ALLOWED_ORIGINS to code base

* Add FORESTCLIENTAPI_ADDRESS

* Add KEYCLOAK_REALM_URL

* Add FORESTCLIENTAPI_ADDRESS

* Extra backend label

* Add FORESTCLIENTAPI_KEY

* Create secret for backend

* Update SERVICE_NAME
  • Loading branch information
DerekRoberts authored May 9, 2023
1 parent 6826fa4 commit 5e694cd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
-p NAME=${{ github.event.repository.name }}
-p ORACLE_DB_USER=${{ secrets.DB_USER }}
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}'
-p FORESTCLIENTAPI_KEY='${{ secrets.FORESTCLIENTAPI_KEY }}'

builds:
name: Builds
Expand Down
31 changes: 14 additions & 17 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ metadata:
iconClass: icon-java
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Module name
Expand All @@ -24,6 +23,13 @@ parameters:
value: latest
- name: DOMAIN
value: apps.silver.devops.gov.bc.ca
- name: ALLOWED_ORIGINS
description: Sets all the allowed request origins
value: "http://localhost:300*,https://*.apps.silver.devops.gov.bc.ca"
- name: KEYCLOAK_REALM_URL
value: "https://test.loginproxy.gov.bc.ca/auth/realms/standard"
- name: FORESTCLIENTAPI_ADDRESS
value: "https://nr-forest-client-api-prod.api.gov.bc.ca/api"
- name: CPU_REQUEST
value: "75m"
- name: MEMORY_REQUEST
Expand Down Expand Up @@ -101,15 +107,16 @@ objects:
- name: NR_SPAR_BACKEND_VERSION
value: ${BUILD}
- name: ALLOWED_ORIGINS
valueFrom:
secretKeyRef:
name: ${NAME}-backend
key: allowed_origins
value: ${ALLOWED_ORIGINS}
- name: KEYCLOAK_REALM_URL
value: ${KEYCLOAK_REALM_URL}
- name: FORESTCLIENTAPI_ADDRESS
value: ${FORESTCLIENTAPI_ADDRESS}
- name: FORESTCLIENTAPI_KEY
valueFrom:
secretKeyRef:
name: ${NAME}-backend
key: keycloak-realm-url
name: ${NAME}-${ZONE}-backend
key: forest-client-api-key
- name: POSTGRESQL_HOST
value: ${NAME}-${ZONE}-database
- name: POSTGRESQL_DATABASE
Expand All @@ -127,16 +134,6 @@ objects:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-user
- name: FORESTCLIENTAPI_ADDRESS
valueFrom:
secretKeyRef:
name: ${NAME}-backend
key: forest-client-api.address
- name: FORESTCLIENTAPI_KEY
valueFrom:
secretKeyRef:
name: ${NAME}-backend
key: forest-client-api.key
ports:
- containerPort: 8090
protocol: TCP
Expand Down
10 changes: 10 additions & 0 deletions common/openshift.init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ parameters:
description: Password for the PostgreSQL connection user.
from: "[a-zA-Z0-9]{16}"
generate: expression
- name: FORESTCLIENTAPI_KEY
required: true
- name: ORACLE_DB_USER
description: Oracle database username for API
required: true
Expand All @@ -42,6 +44,14 @@ objects:
stringData:
oracle-user: ${ORACLE_DB_USER}
oracle-password: ${ORACLE_DB_PASSWORD}
- apiVersion: v1
kind: Secret
metadata:
name: ${NAME}-${ZONE}-backend
labels:
app: ${NAME}-${ZONE}
stringData:
forest-client-api-key: ${FORESTCLIENTAPI_KEY}
- apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
Expand Down
2 changes: 1 addition & 1 deletion oracle-api/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parameters:
value: "1543"
- name: SERVICE_NAME
description: The database's name
value: fortmp1.nrs.bcgov
value: dbq01.nrs.bcgov
- name: KEYCLOAK_REALM_URL
description: Keycloak realm address
value: https://test.loginproxy.gov.bc.ca/auth/realms/standard
Expand Down

0 comments on commit 5e694cd

Please sign in to comment.