[COMMON] Enhance common/postgres to support operator based user and db creation 38/142638/2
authorFiete Ostkamp <fiete.ostkamp@telekom.de>
Thu, 4 Dec 2025 07:27:57 +0000 (08:27 +0100)
committerFiete Ostkamp <fiete.ostkamp@telekom.de>
Thu, 4 Dec 2025 10:09:23 +0000 (11:09 +0100)
commit24397534f29f521d186e61f8b70f65c0f4fe7465
tree0c8114bd2404de48e4f9921de41c58f40cf9ae43
parentb0ffa29fa47a12d20587dc372abacb96bcd6d5c7
[COMMON] Enhance common/postgres to support operator based user and db creation

- add .postgresOperator.autoCreateUserSchema that can be set to true to automatically
  create a user-named schema inside the postgres db [0]
- add .postgresOperator.databaseInitSQL.key + .name to point the operator to an sql
  script inside a configmap [1]
- add .postgresOperator.users[].name to create the instance with certain users [2]
- add .postgresOperator.users[].databases[] to create the instance with certain dbs [3]
- add .postgresOperator.users[].options to grant a user certain role privileges [3]
- define a "common.postgresOperator.userSecret" function that returns the secret name
  that is created by the operator and that contains the user credentials.
  It works with the first entry of the .postgresOperator.user array for it's input params

[0] https://access.crunchydata.com/documentation/postgres-operator/latest/tutorials/basic-setup/user-management#why-is-the-schema-named-after-the-user
[1] https://access.crunchydata.com/documentation/postgres-operator/latest/tutorials/day-two/customize-cluster#initialization-sql-configmap
[2] https://access.crunchydata.com/documentation/postgres-operator/latest/tutorials/basic-setup/user-management#creating-a-new-user
[3] https://access.crunchydata.com/documentation/postgres-operator/latest/tutorials/basic-setup/user-management#creating-a-new-database

Issue-ID: OOM-3374
Change-Id: I3e64a71b3135a40f95531ea455b6084c330f0d6a
Signed-off-by: Fiete Ostkamp <fiete.ostkamp@telekom.de>
kubernetes/common/common/Chart.yaml
kubernetes/common/common/templates/_postgres.tpl
kubernetes/common/common/templates/_secret.tpl