From d60805985bf7c87f3caf89bbad40d36411cf3306 Mon Sep 17 00:00:00 2001 From: marcellmueller Date: Thu, 6 Apr 2023 14:15:00 -0700 Subject: [PATCH] feat: add ability to define extra postgres users --- .../crunchy-postgres/templates/PostgresCluster.yaml | 6 ++++++ operations/deployment/crunchy-postgres/values.yaml | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/operations/deployment/crunchy-postgres/templates/PostgresCluster.yaml b/operations/deployment/crunchy-postgres/templates/PostgresCluster.yaml index 6013a01..d9135a6 100644 --- a/operations/deployment/crunchy-postgres/templates/PostgresCluster.yaml +++ b/operations/deployment/crunchy-postgres/templates/PostgresCluster.yaml @@ -87,6 +87,12 @@ spec: - name: postgres databases: - {{ template "crunchy-postgres.fullname" . }} + {{- if .Values.postgres.extraUsers.enabled }} + {{- with .Values.postgres.extraUsers.users }} + {{- toYaml . | indent 2 }} + {{- end }} + {{- end }} + backups: pgbackrest: image: {{ .Values.pgbackrest.image }} diff --git a/operations/deployment/crunchy-postgres/values.yaml b/operations/deployment/crunchy-postgres/values.yaml index c57f990..5f4830b 100644 --- a/operations/deployment/crunchy-postgres/values.yaml +++ b/operations/deployment/crunchy-postgres/values.yaml @@ -34,6 +34,19 @@ crunchyImage: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-postgres: # https://access.crunchydata.com/documentation/postgres-operator/v5/architecture/pgadmin4/ postgresVersion: 14 +postgres: + # List that allows an undefined amount of new users to be created + # Be sure to changed the 'crunchy-postgres' database name if you changed the fullNameOverride variable + extraUsers: + enabled: false + users: | + - name: extra-user-1 + databases: + - crunchy-postgres + options: "CREATEROLE" + - name: extra-user-2 + databases: + - crunchy-postgres # Postgres Cluster resource values: pgmonitor: enabled: false