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

chore: add params to make crunchy optional, and document the steps needed. #2150

Merged
merged 6 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions .github/workflows/.dbdeployer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ on:
default: 'values.yaml'
required: false
type: string
enabled:
description: 'Enable the deployment of the crunchy database, easy switch to turn it on/off'
default: false
required: false
type: boolean

secrets:
oc_namespace:
description: OpenShift namespace
Expand All @@ -48,6 +54,7 @@ on:
jobs:
deploy_db:
runs-on: ubuntu-24.04
if: ${{ inputs.enabled }}
name: Deploy Or Upgrade Crunchy DB
environment: ${{ inputs.environment }}
steps:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ jobs:
- name: Remove PR user and database from crunchy.
shell: bash
run: |

# check if postgres-crunchy exists or else exit
oc get PostgresCluster/postgres-crunchy || exit 0

# Remove the user from the crunchy cluster yaml and apply the changes
USER_TO_REMOVE='{"databases":["app-${{ github.event.number }}"],"name":"app-${{ github.event.number }}"}'

echo 'getting current users from crunchy'
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ Crunchy is the default choice for HA postgres/postgis DB in BCGov. provided char

* For specifying different resources for different envs, just add values-test.yml and values-prod.yml , then provide them to the [DB Deployer in GHA](.github/workflows/.dbdeployer.yml#L24).
* For enabling S3 backups/recovery, please enable in [values file](./charts/crunchy/values.yaml#L62), and in the [DB Deployer in GHA](.github/workflows/.dbdeployer.yml#L20), then provide necessary secret values which are prefixed with `s3` [DB Deployer in GHA](.github/workflows/.dbdeployer.yml#L36)
* To disable crunchy deployment, make the following changes
* make crunchy enabled to false in [values.yaml](./charts/app/values.yaml#L117)
* make bitnami postgis enabled to true in [values.yaml](./charts/app/values.yaml#L120)
* make the db-deployer false in gha workflow [.dbdeployer.yaml](./.github/workflows/.dbdeployer.yml#L31)

## Alternative Backends

Expand Down
2 changes: 2 additions & 0 deletions charts/app/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ data:
FLYWAY_PASSWORD: {{ $databasePassword | quote }}

---
{{- if not .Values.crunchy.enabled}} # only when it is bitnami-postgres
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -76,3 +77,4 @@ data:
postgres-password: {{ $databasePassword | quote }}
password: {{ $databasePassword | quote }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ frontend:
minAvailable: 1 # the minimum number of pods that must be available during the disruption budget.

crunchy:
enabled: true # make this false and bitnami-pg true to switch from crunchy to bitnami single postgis.
enabled: false # make this false and bitnami-pg true to switch from crunchy to bitnami single postgis.

bitnamiPostgis:
enabled: false
enabled: true
image:
registry: ghcr.io
repository: bcgov/nr-containers/bitnami/postgresql
Expand Down
Loading