Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing refrencing secrets from github env secrets. Allows us to kee… #94

Merged
merged 22 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,11 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
name: [backend, database, frontend, init]
name: [backend, frontend, init]
include:
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
Expand Down Expand Up @@ -103,14 +100,11 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
name: [backend, database, frontend, init]
name: [backend, frontend, init]
include:
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
package: [backend, database, frontend]
package: [backend, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ jobs:
packages: write
strategy:
matrix:
package: [backend, database, frontend]
package: [backend, frontend]
include:
- package: backend
triggers: ('backend/')
- package: database
triggers: ('database/')
- package: frontend
triggers: ('frontend/')
steps:
Expand All @@ -75,22 +73,24 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
name: [backend, database, init, frontend]
name: [backend, init, frontend]
include:
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
- name: init
file: common/openshift.init.yml
overwrite: false
#parameters:
#-p DATABASE_NAME=${{secrets.OC_DATABASE_NAME}}
#-p DATABASE_USER=${{secrets.OC_DATABASE_USER}}
#-p DATABASE_PASSWORD=${{secrets.OC_DATABASE_PASSWORD}}
#-p DATABASE_HOST=${{secrets.OC_DATABASE_HOST}}
steps:
- uses: bcgov-nr/[email protected]
with:
Expand All @@ -101,6 +101,11 @@ jobs:
overwrite: ${{ matrix.overwrite }}
penetration_test: false
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }}
-p ZONE=${{ github.event.number }}
-p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }}
-p DATABASE_NAME=${{secrets.OC_DATABASE_NAME}}
-p DATABASE_USER=${{secrets.OC_DATABASE_USER}}
-p DATABASE_PASSWORD=${{secrets.OC_DATABASE_PASSWORD}}
-p DATABASE_HOST=${{secrets.OC_DATABASE_HOST}}
${{ matrix.parameters }}
69 changes: 60 additions & 9 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,40 @@ parameters:
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: bcgov/onroutebc:prod-backend
- name: DATABASE_NAME
description: Name of Database to connect to
required: true
- name: DATABASE_USER
description: User connecting to database
required: true
- name: DATABASE_PASSWORD
description: Password of user connecting to database
required: true
- name: DATABASE_HOST
description: Host url/service of database connection
required: true
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
data:
database-type: mssql
database-name: "${DATABASE_NAME}"
database-host: "${DATABASE_HOST}"
database-encrypt: "false"
database-port: "1433"
- apiVersion: v1
kind: Secret
metadata:
labels:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
stringData:
database-user: "${DATABASE_USER}"
database-password: "${DATABASE_PASSWORD}"
- apiVersion: v1
kind: ImageStream
metadata:
Expand Down Expand Up @@ -88,22 +121,40 @@ objects:
imagePullPolicy: Always
name: ${NAME}
env:
- name: POSTGRESQL_HOST
value: ${NAME}-${ZONE}-database
- name: POSTGRESQL_DATABASE
- name: DB_TYPE
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
configMapKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-type
- name: MSSQL_HOST
valueFrom:
configMapKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-host
- name: MSSQL_PORT
valueFrom:
configMapKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-port
- name: MSSQL_DB
valueFrom:
configMapKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-name
- name: POSTGRESQL_PASSWORD
- name: MSSQL_ENCRYPT
valueFrom:
configMapKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-encrypt
- name: MSSQL_SA_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-password
- name: POSTGRESQL_USER
- name: MSSQL_SA_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-user
ports:
- containerPort: 5000
Expand Down
29 changes: 12 additions & 17 deletions common/openshift.init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,24 @@ parameters:
- name: NAME
description: Product name
value: onroutebc
- name: PG_DATABASE
description: Postgres database name
value: database
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: PROMOTE
description: Dummy param, for convenience in deployments
- name: DB_PASSWORD
description: Password for the PostgreSQL connection user.
from: "[a-zA-Z0-9]{16}"
generate: expression
- name: DATABASE_NAME
description: Name of Database to connect to
required: true
- name: DATABASE_USER
description: User connecting to database
required: true
- name: DATABASE_PASSWORD
description: Password of user connecting to database
required: true
- name: DATABASE_HOST
description: Host url/service of database connection
required: true
objects:
- apiVersion: v1
kind: Secret
metadata:
name: ${NAME}-${ZONE}-${PG_DATABASE}
labels:
app: ${NAME}-${ZONE}
stringData:
database-name: ${NAME}
database-password: ${DB_PASSWORD}
database-user: ${NAME}
- apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
Expand Down
12 changes: 12 additions & 0 deletions database/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ parameters:
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
required: true
- name: DATABASE_NAME
description: Name of Database to connect to
required: true
- name: DATABASE_USER
description: User connecting to database
required: true
- name: DATABASE_PASSWORD
description: Password of user connecting to database
required: true
- name: DATABASE_HOST
description: Host url/service of database connection
required: true
objects:
- kind: PersistentVolumeClaim
apiVersion: v1
Expand Down
12 changes: 12 additions & 0 deletions frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ parameters:
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: bcgov/onroutebc:prod-frontend
- name: DATABASE_NAME
description: Name of Database to connect to
required: true
- name: DATABASE_USER
description: User connecting to database
required: true
- name: DATABASE_PASSWORD
description: Password of user connecting to database
required: true
- name: DATABASE_HOST
description: Host url/service of database connection
required: true
objects:
- apiVersion: v1
kind: ImageStream
Expand Down