diff --git a/charts/postgres-cluster/Chart.yaml b/charts/postgres-cluster/Chart.yaml index 980a881..7854872 100644 --- a/charts/postgres-cluster/Chart.yaml +++ b/charts/postgres-cluster/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: postgres-cluster -version: 2.3.7 +version: 2.3.8 description: Chart for cloudnative-pg cluster keywords: - database diff --git a/charts/postgres-cluster/templates/_bootstrap.tpl b/charts/postgres-cluster/templates/_bootstrap.tpl index 29d6fe7..df8b20f 100644 --- a/charts/postgres-cluster/templates/_bootstrap.tpl +++ b/charts/postgres-cluster/templates/_bootstrap.tpl @@ -58,19 +58,18 @@ externalClusters: recoveryTarget: targetTime: {{ . }} {{- end }} - source: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" + source: {{ include "cluster.recoveryServerName" . }} externalClusters: - - name: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" + - name: {{ include "cluster.recoveryServerName" . }} barmanObjectStore: - serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" - destinationPath: "s3://{{ .Values.recovery.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ include "cluster.recoveryName" . }}" + serverName: {{ include "cluster.recoveryServerName" . }} + destinationPath: "s3://{{ .Values.recovery.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ include "cluster.recoveryInstanceName" . }}" endpointURL: {{ .Values.recovery.endpointURL }} {{- with .Values.recovery.endpointCA }} endpointCA: name: {{ . }} key: ca-bundle.crt {{- end }} - serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" s3Credentials: accessKeyId: name: {{ include "cluster.recoveryCredentials" . }} diff --git a/charts/postgres-cluster/templates/_helpers.tpl b/charts/postgres-cluster/templates/_helpers.tpl index b923617..401bf76 100644 --- a/charts/postgres-cluster/templates/_helpers.tpl +++ b/charts/postgres-cluster/templates/_helpers.tpl @@ -71,9 +71,20 @@ Generate backup server name {{/* Generate recovery server name */}} -{{- define "cluster.recoveryName" -}} - {{- if .Values.recovery.recoveryName -}} - {{- .Values.recovery.recoveryName -}} +{{- define "cluster.recoveryServerName" -}} + {{- if .Values.recovery.recoveryServerName -}} + {{- .Values.recovery.recoveryServerName -}} + {{- else -}} + {{- printf "%s-backup-%s" (include "cluster.name" .) .Values.recovery.recoveryIndex | trunc 63 | trimSuffix "-" -}} + {{- end }} +{{- end }} + +{{/* +Generate recovery instance name +*/}} +{{- define "cluster.recoveryInstanceName" -}} + {{- if .Values.recovery.recoveryInstanceName -}} + {{- .Values.recovery.recoveryInstanceName -}} {{- else -}} {{ include "cluster.name" . }} {{- end }} diff --git a/charts/postgres-cluster/values.yaml b/charts/postgres-cluster/values.yaml index 176b9c7..26ab974 100644 --- a/charts/postgres-cluster/values.yaml +++ b/charts/postgres-cluster/values.yaml @@ -107,11 +107,14 @@ recovery: # Specifies secret that contains S3 credentials, should contain the keys ACCESS_KEY_ID and ACCESS_SECRET_KEY endpointCredentials: "" - # Generate external cluster name, uses: postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}" + # Generate external cluster name, uses: {{ .Release.Name }}postgresql--cluster-backup-index-{{ .Values.recovery.recoveryIndex }} recoveryIndex: 1 # Name of the recovery cluster in the object store, defaults to "cluster.name" - recoveryName: "" + recoveryServerName: "" + + # Name of the recovery cluster in the object store, defaults to ".Release.Name" + recoveryInstanceName: "" wal: # WAL compression method. One of `` (for no compression), `gzip`, `bzip2` or `snappy`.