From 472dbe8fbbddc8133124744eb961160352a03ce8 Mon Sep 17 00:00:00 2001 From: Max Roby Date: Thu, 2 Nov 2023 16:39:39 +0100 Subject: [PATCH] add support for bootstrap and initdb options --- charts/cloudnative-pg-tenant/Chart.yaml | 2 +- charts/cloudnative-pg-tenant/README.md | 7 ++++++- charts/cloudnative-pg-tenant/templates/tenant.yaml | 10 +++++++--- charts/cloudnative-pg-tenant/values.yaml | 12 ++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/charts/cloudnative-pg-tenant/Chart.yaml b/charts/cloudnative-pg-tenant/Chart.yaml index 8591394..84cc257 100644 --- a/charts/cloudnative-pg-tenant/Chart.yaml +++ b/charts/cloudnative-pg-tenant/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: cnpg-tenant description: Create postgres tenant clusters managed by the CNPG Operator type: application -version: 0.0.1 +version: 0.0.2 maintainers: - name: "cloudymax" diff --git a/charts/cloudnative-pg-tenant/README.md b/charts/cloudnative-pg-tenant/README.md index 9aa7968..f634693 100644 --- a/charts/cloudnative-pg-tenant/README.md +++ b/charts/cloudnative-pg-tenant/README.md @@ -1,6 +1,6 @@ # cnpg-tenant -![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Create postgres tenant clusters managed by the CNPG Operator @@ -20,6 +20,10 @@ Create postgres tenant clusters managed by the CNPG Operator | backup.s3Credentials.accessKeyId.name | string | `"aws-creds"` | | | backup.s3Credentials.secretAccessKey.key | string | `"ACCESS_SECRET_KEY"` | | | backup.s3Credentials.secretAccessKey.name | string | `"aws-creds"` | | +| bootstrap.initdb.database | string | `"app"` | | +| bootstrap.initdb.owner | string | `"app"` | | +| bootstrap.initdb.postInitSQL[0] | string | `"CREATE ROLE friend"` | | +| bootstrap.initdb.secret.name | string | `"app-secret"` | | | instances | int | `3` | | | monitoring.enablePodMonitor | bool | `true` | | | name | string | `"example"` | | @@ -30,6 +34,7 @@ Create postgres tenant clusters managed by the CNPG Operator | scheduledBackup.spec.cluster.name | string | `"pg-backup"` | | | scheduledBackup.spec.schedule | string | `"0 0 0 * * *"` | | | storage.size | string | `"1Gi"` | | +| superuserSecret.name | string | `"superuser-secret"` | | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3) diff --git a/charts/cloudnative-pg-tenant/templates/tenant.yaml b/charts/cloudnative-pg-tenant/templates/tenant.yaml index 23846b4..cfcb845 100644 --- a/charts/cloudnative-pg-tenant/templates/tenant.yaml +++ b/charts/cloudnative-pg-tenant/templates/tenant.yaml @@ -18,12 +18,16 @@ spec: retentionPolicy: {{ .Values.backup.retentionPolicy }} monitoring: enablePodMonitor: {{ .Values.monitoring.enablePodMonitor }} + {{- with .Values.postgresql }} postgresql: - pg_hba: - - hostnossl all all 0.0.0.0/0 reject - - hostssl all all 0.0.0.0/0 cert clientcert=verify-full + {{- toYaml . | nindent 4}} + {{- end }} storage: size: {{ .Values.storage.size }} + {{- with .Values.bootstrap }} + bootstrap: + {{- toYaml . | nindent 4 }} + {{- end }} --- apiVersion: postgresql.cnpg.io/v1 kind: ScheduledBackup diff --git a/charts/cloudnative-pg-tenant/values.yaml b/charts/cloudnative-pg-tenant/values.yaml index 67d0557..15709a7 100644 --- a/charts/cloudnative-pg-tenant/values.yaml +++ b/charts/cloudnative-pg-tenant/values.yaml @@ -2,6 +2,18 @@ name: "example" instances: 3 +superuserSecret: + name: superuser-secret + +bootstrap: + initdb: + database: app + owner: app + secret: + name: app-secret + postInitSQL: + - CREATE ROLE friend + backup: destinationPath: "backups" retentionPolicy: "30d"