diff --git a/charts/cluster/README.md b/charts/cluster/README.md index e78897586..0d42c6d87 100644 --- a/charts/cluster/README.md +++ b/charts/cluster/README.md @@ -247,7 +247,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat | recovery.owner | string | `""` | Name of the owner of the database in the instance to be used by applications. Defaults to the value of the `database` key. | | recovery.pgBaseBackup.database | string | `"app"` | Name of the database used by the application. Default: `app`. | | recovery.pgBaseBackup.owner | string | `""` | Name of the owner of the database in the instance to be used by applications. Defaults to the value of the `database` key. | -| recovery.pgBaseBackup.secret | string | `""` | Name of the secret containing the initial credentials for the owner of the user database. If empty a new secret will be created from scratch | +| recovery.pgBaseBackup.secretName | string | `""` | Name of the secret containing the initial credentials for the owner of the user database. If empty a new secret will be created from scratch. The secret should include | | recovery.pgBaseBackup.source.database | string | `"app"` | | | recovery.pgBaseBackup.source.host | string | `""` | | | recovery.pgBaseBackup.source.passwordSecret.create | bool | `false` | Whether to create a secret for the password | diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index 95bedd214..0693d6e4b 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -37,9 +37,9 @@ bootstrap: {{ with .Values.recovery.pgBaseBackup.owner }} owner: {{ . }} {{- end }} - {{ with .Values.recovery.pgBaseBackup.secret }} + {{ with .Values.recovery.pgBaseBackup.secretName }} secret: - {{- toYaml . | nindent 6 }} + name: {{ . }} {{- end }} externalClusters: diff --git a/charts/cluster/test/postgresql-pg_basebackup/02-pg_basebackup-cluster.yaml b/charts/cluster/test/postgresql-pg_basebackup/02-pg_basebackup-cluster.yaml index 310074e1d..3f495b5ba 100644 --- a/charts/cluster/test/postgresql-pg_basebackup/02-pg_basebackup-cluster.yaml +++ b/charts/cluster/test/postgresql-pg_basebackup/02-pg_basebackup-cluster.yaml @@ -14,6 +14,7 @@ recovery: sslCertSecret: name: source-cluster-replication key: tls.crt + secretName: "mysecret" cluster: instances: 2 diff --git a/charts/cluster/test/postgresql-pg_basebackup/02-secret.yaml b/charts/cluster/test/postgresql-pg_basebackup/02-secret.yaml new file mode 100644 index 000000000..cfb71cdcc --- /dev/null +++ b/charts/cluster/test/postgresql-pg_basebackup/02-secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mysecret +type: kubernetes.io/basic-auth +data: + username: YXBw + password: cGFzc3dvcmQ= diff --git a/charts/cluster/test/postgresql-pg_basebackup/chainsaw-test.yaml b/charts/cluster/test/postgresql-pg_basebackup/chainsaw-test.yaml index 85f2d9743..2ae035f08 100644 --- a/charts/cluster/test/postgresql-pg_basebackup/chainsaw-test.yaml +++ b/charts/cluster/test/postgresql-pg_basebackup/chainsaw-test.yaml @@ -38,6 +38,8 @@ spec: --values ./02-pg_basebackup-cluster.yaml \ --wait \ pg-basebackup ../../ + - apply: + file: ./02-secret.yaml - assert: file: ./02-pg_basebackup-cluster-assert.yaml catch: diff --git a/charts/cluster/values.schema.json b/charts/cluster/values.schema.json index 47edeb9ea..5aafc9c89 100644 --- a/charts/cluster/values.schema.json +++ b/charts/cluster/values.schema.json @@ -563,7 +563,7 @@ "owner": { "type": "string" }, - "secret": { + "secretName": { "type": "string" }, "source": { diff --git a/charts/cluster/values.yaml b/charts/cluster/values.yaml index 9e49d64a3..2e39fb17e 100644 --- a/charts/cluster/values.yaml +++ b/charts/cluster/values.yaml @@ -103,8 +103,8 @@ recovery: pgBaseBackup: # -- Name of the database used by the application. Default: `app`. database: app - # -- Name of the secret containing the initial credentials for the owner of the user database. If empty a new secret will be created from scratch - secret: "" + # -- Name of the kubernetes.io/basic-auth secret containing the initial credentials for the owner of the user database. If empty a new secret will be created from scratch. + secretName: "" # -- Name of the owner of the database in the instance to be used by applications. Defaults to the value of the `database` key. owner: "" source: