update to use object store crd
Some checks failed
release-charts-postgres-cluster / release (push) Failing after 1m9s
Some checks failed
release-charts-postgres-cluster / release (push) Failing after 1m9s
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
{{- define "cluster.backup" -}}
|
||||
{{- if .Values.backup.enabled }}
|
||||
backup:
|
||||
retentionPolicy: {{ .Values.backup.retentionPolicy }}
|
||||
barmanObjectStore:
|
||||
destinationPath: {{ .Values.backup.destinationPath }}
|
||||
endpointURL: {{ .Values.backup.endpointURL }}
|
||||
{{- if .Values.backup.endpointCA.name }}
|
||||
endpointCA:
|
||||
name: {{ .Values.backup.endpointCA.name }}
|
||||
key: {{ .Values.backup.endpointCA.key }}
|
||||
{{- end }}
|
||||
serverName: "{{ include "cluster.backupName" . }}-backup-{{ .Values.backup.backupIndex }}"
|
||||
wal:
|
||||
compression: {{ .Values.backup.wal.compression }}
|
||||
{{- with .Values.backup.wal.encryption}}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
maxParallel: {{ .Values.backup.wal.maxParallel }}
|
||||
data:
|
||||
compression: {{ .Values.backup.data.compression }}
|
||||
{{- with .Values.backup.data.encryption }}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
jobs: {{ .Values.backup.data.jobs }}
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: {{ include "cluster.backupCredentials" . }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: {{ include "cluster.backupCredentials" . }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
{{- end }}
|
||||
{{- end }}
|
@@ -14,16 +14,9 @@ bootstrap:
|
||||
{{- if eq .Values.type "tensorchord" }}
|
||||
dataChecksums: true
|
||||
{{- end }}
|
||||
{{- if or (eq .Values.type "postgis") (eq .Values.type "timescaledb") (eq .Values.type "tensorchord") (.Values.cluster.initdb.postInitApplicationSQL) }}
|
||||
{{- if or (eq .Values.type "tensorchord") (.Values.cluster.initdb.postInitApplicationSQL) }}
|
||||
postInitApplicationSQL:
|
||||
{{- if eq .Values.type "postgis" }}
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis_topology;
|
||||
- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
|
||||
{{- else if eq .Values.type "timescaledb" }}
|
||||
- CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
{{- else if eq .Values.type "tensorchord" }}
|
||||
{{- if eq .Values.type "tensorchord" }}
|
||||
- ALTER SYSTEM SET search_path TO "$user", public, vectors;
|
||||
- SET search_path TO "$user", public, vectors;
|
||||
- CREATE EXTENSION IF NOT EXISTS "vectors";
|
||||
@@ -136,34 +129,11 @@ externalClusters:
|
||||
|
||||
externalClusters:
|
||||
- name: {{ include "cluster.recoveryServerName" . }}
|
||||
barmanObjectStore:
|
||||
serverName: {{ include "cluster.recoveryServerName" . }}
|
||||
endpointURL: {{ .Values.recovery.objectStore.endpointURL }}
|
||||
destinationPath: {{ .Values.recovery.objectStore.destinationPath }}
|
||||
{{- if .Values.recovery.objectStore.endpointCA.name }}
|
||||
endpointCA:
|
||||
name: {{ .Values.recovery.objectStore.endpointCA.name }}
|
||||
key: {{ .Values.recovery.objectStore.endpointCA.key }}
|
||||
{{- end }}
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: {{ include "cluster.recoveryCredentials" . }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: {{ include "cluster.recoveryCredentials" . }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
wal:
|
||||
compression: {{ .Values.recovery.objectStore.wal.compression }}
|
||||
{{- with .Values.recovery.objectStore.wal.encryption}}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
maxParallel: {{ .Values.recovery.objectStore.wal.maxParallel }}
|
||||
data:
|
||||
compression: {{ .Values.recovery.objectStore.data.compression }}
|
||||
{{- with .Values.recovery.objectStore.data.encryption }}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
jobs: {{ .Values.recovery.objectStore.data.jobs }}
|
||||
plugin:
|
||||
name: barman-cloud.cloudnative-pg.io
|
||||
parameters:
|
||||
barmanObjectName: "{{ include "cluster.name" . }}-{{ .Values.recovery.objectStore.name }}"
|
||||
serverName: {{ include "cluster.recoveryServerName" . }}
|
||||
|
||||
{{- else }}
|
||||
{{ fail "Invalid recovery mode!" }}
|
||||
|
@@ -23,7 +23,7 @@ Common labels
|
||||
helm.sh/chart: {{ include "cluster.chart" $ }}
|
||||
{{ include "cluster.selectorLabels" $ }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.Version | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.cluster.additionalLabels }}
|
||||
@@ -37,7 +37,7 @@ Selector labels
|
||||
{{- define "cluster.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "cluster.name" $ }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/part-of: cloudnative-pg
|
||||
app.kubernetes.io/part-of: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
@@ -51,83 +51,12 @@ Allow the release namespace to be overridden for multi-namespace deployments in
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Whether we need to use TimescaleDB defaults
|
||||
*/}}
|
||||
{{- define "cluster.useTimescaleDBDefaults" -}}
|
||||
{{ and (eq .Values.type "timescaledb") .Values.imageCatalog.create (empty .Values.cluster.imageCatalogRef.name) (empty .Values.imageCatalog.images) (empty .Values.cluster.imageName) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Cluster Image Name
|
||||
If a custom imageName is available, use it, otherwise use the defaults based on the .Values.type
|
||||
*/}}
|
||||
{{- define "cluster.imageName" -}}
|
||||
{{- if .Values.cluster.image.repository -}}
|
||||
{{- printf "%s:%s" .Values.cluster.image.repository .Values.cluster.image.tag -}}
|
||||
{{- else if eq .Values.type "postgresql" -}}
|
||||
{{- printf "ghcr.io/cloudnative-pg/postgresql:%s" .Values.version.postgresql -}}
|
||||
{{- else if eq .Values.type "postgis" -}}
|
||||
{{- printf "ghcr.io/cloudnative-pg/postgis:%s-%s" .Values.version.postgresql .Values.version.postgis -}}
|
||||
{{- else -}}
|
||||
{{ fail "Invalid cluster type!" }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Cluster Image
|
||||
If imageCatalogRef defined, use it, otherwise calculate ordinary imageName.
|
||||
*/}}
|
||||
{{- define "cluster.image" }}
|
||||
{{- if .Values.cluster.imageCatalogRef.name }}
|
||||
imageCatalogRef:
|
||||
apiGroup: postgresql.cnpg.io
|
||||
{{- toYaml .Values.cluster.imageCatalogRef | nindent 2 }}
|
||||
major: {{ include "cluster.postgresqlMajor" . }}
|
||||
{{- else if and .Values.imageCatalog.create (not (empty .Values.imageCatalog.images )) }}
|
||||
imageCatalogRef:
|
||||
apiGroup: postgresql.cnpg.io
|
||||
kind: ImageCatalog
|
||||
name: {{ include "cluster.name" . }}
|
||||
major: {{ include "cluster.postgresqlMajor" . }}
|
||||
{{- else if eq (include "cluster.useTimescaleDBDefaults" .) "true" -}}
|
||||
imageCatalogRef:
|
||||
apiGroup: postgresql.cnpg.io
|
||||
kind: ImageCatalog
|
||||
name: {{ include "cluster.name" . }}-timescaledb-ha
|
||||
major: {{ include "cluster.postgresqlMajor" . }}
|
||||
{{- else }}
|
||||
imageName: {{ include "cluster.imageName" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Generate name for object store credentials
|
||||
*/}}
|
||||
{{- define "cluster.recoveryCredentials" -}}
|
||||
{{- if .Values.recovery.endpointCredentials -}}
|
||||
{{- .Values.recovery.endpointCredentials -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "cluster.backupCredentials" -}}
|
||||
{{- if .Values.backup.endpointCredentials -}}
|
||||
{{- .Values.backup.endpointCredentials -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Postgres UID
|
||||
*/}}
|
||||
{{- define "cluster.postgresUID" -}}
|
||||
{{- if ge (int .Values.cluster.postgresUID) 0 -}}
|
||||
{{- .Values.cluster.postgresUID }}
|
||||
{{- else if and (eq (include "cluster.useTimescaleDBDefaults" .) "true") (eq .Values.type "timescaledb") -}}
|
||||
{{- 1000 -}}
|
||||
{{- else -}}
|
||||
{{- 26 -}}
|
||||
{{- end -}}
|
||||
@@ -139,24 +68,11 @@ Postgres GID
|
||||
{{- define "cluster.postgresGID" -}}
|
||||
{{- if ge (int .Values.cluster.postgresGID) 0 -}}
|
||||
{{- .Values.cluster.postgresGID }}
|
||||
{{- else if and (eq (include "cluster.useTimescaleDBDefaults" .) "true") (eq .Values.type "timescaledb") -}}
|
||||
{{- 1000 -}}
|
||||
{{- else -}}
|
||||
{{- 26 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate backup server name
|
||||
*/}}
|
||||
{{- define "cluster.backupName" -}}
|
||||
{{- if .Values.backup.backupName -}}
|
||||
{{- .Values.backup.backupName -}}
|
||||
{{- else -}}
|
||||
{{ include "cluster.name" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Generate recovery server name
|
||||
*/}}
|
||||
@@ -167,3 +83,14 @@ Generate recovery server name
|
||||
{{- printf "%s-backup-%s" (include "cluster.name" .) (toString .Values.recovery.recoveryIndex) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Generate name for recovery object store credentials
|
||||
*/}}
|
||||
{{- define "cluster.recoveryCredentials" -}}
|
||||
{{- if .Values.recovery.endpointCredentials -}}
|
||||
{{- .Values.recovery.endpointCredentials -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@@ -11,7 +11,6 @@ metadata:
|
||||
{{- include "cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
instances: {{ .Values.cluster.instances }}
|
||||
{{- include "cluster.image" . | nindent 2 }}
|
||||
imageName: "{{ .Values.cluster.image.repository }}:{{ .Values.cluster.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.cluster.imagePullPolicy }}
|
||||
{{- with .Values.cluster.imagePullSecrets }}
|
||||
@@ -20,6 +19,23 @@ spec:
|
||||
{{- end }}
|
||||
postgresUID: {{ include "cluster.postgresUID" . }}
|
||||
postgresGID: {{ include "cluster.postgresGID" . }}
|
||||
{{ if or (and (.Values.backup.enabled) (eq .Values.backup.method "objectStore")) (eq .Values.recovery.method "objectStore") }}
|
||||
plugins:
|
||||
{{ end }}
|
||||
{{ if and (.Values.backup.enabled) (eq .Values.backup.method "objectStore") }}
|
||||
{{ $context := . -}}
|
||||
{{ range .Values.backup.objectStore -}}
|
||||
- name: barman-cloud.cloudnative-pg.io
|
||||
isWALArchiver: {{ $context.isWALArchiver }}
|
||||
parameters:
|
||||
barmanObjectName: "{{ include "cluster.name" . }}-{{ $context.name }}-backup"
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
{{ if eq .Values.recovery.method "objectStore" }}
|
||||
- name: barman-cloud.cloudnative-pg.io
|
||||
parameters:
|
||||
barmanObjectName: "{{ include "cluster.name" . }}-{{ .Values.recovery.objectStore.name }}"
|
||||
{{ end }}
|
||||
storage:
|
||||
size: {{ .Values.cluster.storage.size }}
|
||||
{{- if not (empty .Values.cluster.storage.storageClass) }}
|
||||
@@ -59,11 +75,8 @@ spec:
|
||||
enablePDB: {{ .Values.cluster.enablePDB }}
|
||||
|
||||
postgresql:
|
||||
{{- if or (eq .Values.type "timescaledb") (eq .Values.type "tensorchord") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }}
|
||||
{{- if or (eq .Values.type "tensorchord") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }}
|
||||
shared_preload_libraries:
|
||||
{{- if eq .Values.type "timescaledb" }}
|
||||
- timescaledb
|
||||
{{- end }}
|
||||
{{- if eq .Values.type "tensorchord" }}
|
||||
- vectors.so
|
||||
{{- end }}
|
||||
@@ -137,4 +150,3 @@ spec:
|
||||
{{- end }}
|
||||
|
||||
{{ include "cluster.bootstrap" . | nindent 2 }}
|
||||
{{ include "cluster.backup" . | nindent 2 }}
|
||||
|
@@ -1,15 +0,0 @@
|
||||
{{ if and .Values.imageCatalog.create (not (empty .Values.imageCatalog.images )) }}
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: ImageCatalog
|
||||
metadata:
|
||||
name: {{ include "cluster.name" $ }}-image-catalog
|
||||
namespace: {{ include "cluster.namespace" $ }}
|
||||
labels:
|
||||
{{- include "cluster.labels" $ | nindent 4 }}
|
||||
spec:
|
||||
images:
|
||||
{{- range $image := .Values.imageCatalog.images }}
|
||||
- image: {{ $image.image }}
|
||||
major: {{ $image.major }}
|
||||
{{- end }}
|
||||
{{- end }}
|
95
charts/postgres-cluster/templates/object-store.yaml
Normal file
95
charts/postgres-cluster/templates/object-store.yaml
Normal file
@@ -0,0 +1,95 @@
|
||||
{{ if and (.Values.backup.enabled) (eq .Values.backup.method "objectStore") }}
|
||||
{{ $context := . -}}
|
||||
{{ range .Values.backup.objectStore -}}
|
||||
---
|
||||
apiVersion: barmancloud.cnpg.io/v1
|
||||
kind: ObjectStore
|
||||
metadata:
|
||||
name: "{{ include "cluster.name" . }}-{{ $context.name }}-backup"
|
||||
namespace: {{ include "cluster.namespace" . }}
|
||||
labels:
|
||||
{{- include "cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
retentionPolicy: {{ $context.retentionPolicy }}
|
||||
configuration:
|
||||
destinationPath: {{ $context.destinationPath }}
|
||||
endpointURL: {{ $context.endpointURL }}
|
||||
{{- if $context.endpointCA.name }}
|
||||
endpointCA:
|
||||
name: {{ $context.endpointCA.name }}
|
||||
key: {{ $context.endpointCA.key }}
|
||||
{{- end }}
|
||||
{{- if $context.clusterName }}
|
||||
serverName: "{{ $context.clusterName }}-backup-{{ $context.index }}"
|
||||
{{- else }}
|
||||
serverName: "{{ include "cluster.name" . }}-backup-{{ $context.index }}"
|
||||
{{- end }}
|
||||
wal:
|
||||
compression: {{ $context.wal.compression }}
|
||||
{{- with $context.wal.encryption}}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
maxParallel: {{ $context.wal.maxParallel }}
|
||||
data:
|
||||
compression: {{ $context.data.compression }}
|
||||
{{- with $context.data.encryption }}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
jobs: {{ $context.data.jobs }}
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
{{- if $context.endpointCredentials }}
|
||||
name: {{ $context.endpointCredentials }}
|
||||
{{- else }}
|
||||
name: {{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
{{- if $context.endpointCredentials }}
|
||||
name: {{ $context.endpointCredentials }}
|
||||
{{- else }}
|
||||
name: {{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Values.recovery.method "objectStore" }}
|
||||
---
|
||||
apiVersion: barmancloud.cnpg.io/v1
|
||||
kind: ObjectStore
|
||||
metadata:
|
||||
name: "{{ include "cluster.name" . }}-{{ .Values.recovery.objectStore.name }}"
|
||||
namespace: {{ include "cluster.namespace" . }}
|
||||
labels:
|
||||
{{- include "cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
configuration:
|
||||
destinationPath: {{ .Values.recovery.objectStore.destinationPath }}
|
||||
endpointURL: {{ .Values.recovery.objectStore.endpointURL }}
|
||||
{{- if .Values.recovery.objectStore.endpointCA.name }}
|
||||
endpointCA:
|
||||
name: {{ .Values.recovery.objectStore.endpointCA.name }}
|
||||
key: {{ .Values.recovery.objectStore.endpointCA.key }}
|
||||
{{- end }}
|
||||
serverName: {{ include "cluster.recoveryServerName" . }}
|
||||
wal:
|
||||
compression: {{ .Values.recovery.objectStore.wal.compression }}
|
||||
{{- with .Values.recovery.objectStore.wal.encryption}}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
maxParallel: {{ .Values.recovery.objectStore.wal.maxParallel }}
|
||||
data:
|
||||
compression: {{ .Values.recovery.objectStore.data.compression }}
|
||||
{{- with .Values.recovery.objectStore.data.encryption }}
|
||||
encryption: {{ . }}
|
||||
{{- end }}
|
||||
jobs: {{ .Values.recovery.objectStore.data.jobs }}
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: {{ include "cluster.recoveryCredentials" . }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: {{ include "cluster.recoveryCredentials" . }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
{{ end }}
|
@@ -11,9 +11,15 @@ metadata:
|
||||
{{- include "cluster.labels" $context | nindent 4 }}
|
||||
spec:
|
||||
immediate: true
|
||||
schedule: {{ .schedule | quote }}
|
||||
backupOwnerReference: {{ .backupOwnerReference }}
|
||||
suspend: {{ $context.suspend }}
|
||||
schedule: {{ $context.schedule | quote }}
|
||||
backupOwnerReference: {{ $context.backupOwnerReference }}
|
||||
cluster:
|
||||
name: {{ include "cluster.name" $context }}-cluster
|
||||
method: plugin
|
||||
pluginConfiguration:
|
||||
name: {{ $context.plugin }}
|
||||
parameters:
|
||||
barmanObjectName: "{{ include "cluster.name" . }}-{{ $context.backupName }}-backup"
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user