Compare commits

...

10 Commits

4 changed files with 28 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
apiVersion: v2 apiVersion: v2
name: postgres-cluster name: postgres-cluster
version: 2.3.2 version: 2.4.2
description: Chart for cloudnative-pg cluster description: Chart for cloudnative-pg cluster
keywords: keywords:
- database - database

View File

@@ -26,20 +26,20 @@ bootstrap:
import: import:
type: {{ .Values.replica.importType }} type: {{ .Values.replica.importType }}
databases: databases:
{{- if and ((len .Values.replica.importDatabases) gt 1) (.Values.replica.importType eq "microservice") }} {{- if and (gt (len .Values.replica.importDatabases) 1) (eq .Values.replica.importType "microservice") }}
{{ fail "Too many databases in import type of microservice!" }} {{ fail "Too many databases in import type of microservice!" }}
{{- else}} {{- else}}
{{- with .Values.replica.importDatabases }} {{- with .Values.replica.importDatabases }}
{{- . | toYaml | nindent 8 }} {{- . | toYaml | nindent 8 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.replica.importType eq "monolith" }} {{- if eq .Values.replica.importType "monolith" }}
roles: roles:
{{- with .Values.replica.importRoles }} {{- with .Values.replica.importRoles }}
{{- . | toYaml | nindent 8 }} {{- . | toYaml | nindent 8 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and (.Values.replica.postImportApplicationSQL) (.Values.replica.importType eq "microservice") }} {{- if and (.Values.replica.postImportApplicationSQL) (eq .Values.replica.importType "microservice") }}
postImportApplicationSQL: postImportApplicationSQL:
{{- with .Values.replica.postImportApplicationSQL }} {{- with .Values.replica.postImportApplicationSQL }}
{{- . | toYaml | nindent 8 }} {{- . | toYaml | nindent 8 }}
@@ -58,19 +58,18 @@ externalClusters:
recoveryTarget: recoveryTarget:
targetTime: {{ . }} targetTime: {{ . }}
{{- end }} {{- end }}
source: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" source: {{ include "cluster.recoveryServerName" . }}
externalClusters: externalClusters:
- name: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" - name: {{ include "cluster.recoveryServerName" . }}
barmanObjectStore: barmanObjectStore:
serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}" serverName: {{ include "cluster.recoveryServerName" . }}
destinationPath: "s3://{{ .Values.recovery.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ include "cluster.recoveryName" . }}" destinationPath: "s3://{{ .Values.recovery.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ include "cluster.recoveryInstanceName" . }}"
endpointURL: {{ .Values.recovery.endpointURL }} endpointURL: {{ .Values.recovery.endpointURL }}
{{- with .Values.recovery.endpointCA }} {{- with .Values.recovery.endpointCA }}
endpointCA: endpointCA:
name: {{ . }} name: {{ . }}
key: ca-bundle.crt key: ca-bundle.crt
{{- end }} {{- end }}
serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}"
s3Credentials: s3Credentials:
accessKeyId: accessKeyId:
name: {{ include "cluster.recoveryCredentials" . }} name: {{ include "cluster.recoveryCredentials" . }}

View File

@@ -71,9 +71,20 @@ Generate backup server name
{{/* {{/*
Generate recovery server name Generate recovery server name
*/}} */}}
{{- define "cluster.recoveryName" -}} {{- define "cluster.recoveryServerName" -}}
{{- if .Values.recovery.recoveryName -}} {{- if .Values.recovery.recoveryServerName -}}
{{- .Values.recovery.recoveryName -}} {{- .Values.recovery.recoveryServerName -}}
{{- else -}}
{{- printf "%s-backup-%s" (include "cluster.name" .) (toString .Values.recovery.recoveryIndex) | trunc 63 | trimSuffix "-" -}}
{{- end }}
{{- end }}
{{/*
Generate recovery instance name
*/}}
{{- define "cluster.recoveryInstanceName" -}}
{{- if .Values.recovery.recoveryInstanceName -}}
{{- .Values.recovery.recoveryInstanceName -}}
{{- else -}} {{- else -}}
{{ include "cluster.name" . }} {{ include "cluster.name" . }}
{{- end }} {{- end }}

View File

@@ -43,7 +43,7 @@ cluster:
cpu: 10m cpu: 10m
limits: limits:
memory: 1Gi memory: 1Gi
cpu: 100m cpu: 800m
hugepages-2Mi: 256Mi hugepages-2Mi: 256Mi
# See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-AffinityConfiguration # See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-AffinityConfiguration
@@ -107,11 +107,14 @@ recovery:
# Specifies secret that contains S3 credentials, should contain the keys ACCESS_KEY_ID and ACCESS_SECRET_KEY # Specifies secret that contains S3 credentials, should contain the keys ACCESS_KEY_ID and ACCESS_SECRET_KEY
endpointCredentials: "" endpointCredentials: ""
# Generate external cluster name, uses: postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}" # Generate external cluster name, uses: {{ .Release.Name }}postgresql-<major version>-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}
recoveryIndex: 1 recoveryIndex: 1
# Name of the recovery cluster in the object store, defaults to "cluster.name" # 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:
# WAL compression method. One of `` (for no compression), `gzip`, `bzip2` or `snappy`. # WAL compression method. One of `` (for no compression), `gzip`, `bzip2` or `snappy`.