fix name helper
All checks were successful
release-charts-postgres-cluster / release (push) Successful in 17s

This commit is contained in:
2025-05-24 01:35:57 -05:00
parent cb5c199d03
commit e98973b467
7 changed files with 38 additions and 38 deletions

View File

@@ -2,7 +2,7 @@
Expand the name of the chart.
*/}}
{{- define "cluster.name" -}}
{{- if not (empty .Values.nameOverride ) }}
{{- if .Values.nameOverride }}
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-postgresql-%s" .Release.Name ((semver .Values.cluster.image.tag).Major | toString) | trunc 63 | trimSuffix "-" -}}

View File

@@ -26,9 +26,9 @@ spec:
{{ $context := . -}}
{{ range .Values.backup.objectStore -}}
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: {{ $context.isWALArchiver }}
isWALArchiver: {{ .isWALArchiver }}
parameters:
barmanObjectName: "{{ include "cluster.name" . }}-{{ $context.name }}-backup"
barmanObjectName: "{{ include "cluster.name" $context }}-{{ .name }}-backup"
{{ end -}}
{{ end }}
{{ if eq .Values.recovery.method "objectStore" }}

View File

@@ -5,48 +5,48 @@
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: "{{ include "cluster.name" $context }}-{{ $context.name }}-backup"
name: "{{ include "cluster.name" $context }}-{{ .name }}-backup"
namespace: {{ include "cluster.namespace" $context }}
labels:
{{- include "cluster.labels" $context | nindent 4 }}
spec:
retentionPolicy: {{ $context.retentionPolicy }}
retentionPolicy: {{ .retentionPolicy }}
configuration:
destinationPath: {{ $context.destinationPath }}
endpointURL: {{ $context.endpointURL }}
{{- if .endpointCA.enabled }}
destinationPath: {{ .destinationPath }}
endpointURL: {{ .endpointURL }}
{{ if .endpointCA.enabled }}
endpointCA:
name: {{ .endpointCA.name }}
key: {{ .endpointCA.key }}
{{- end }}
{{- if not (empty $context.clusterName) }}
serverName: "{{ $context.clusterName }}-backup-{{ $context.index }}"
{{ end }}
{{- if .clusterName }}
serverName: "{{ .clusterName }}-backup-{{ .index }}"
{{- else }}
serverName: "{{ include "cluster.name" $context }}-backup-{{ $context.index }}"
serverName: "{{ include "cluster.name" $context }}-backup-{{ .index }}"
{{- end }}
wal:
compression: {{ $context.wal.compression }}
{{- with $context.wal.encryption}}
compression: {{ .wal.compression }}
{{- with .wal.encryption}}
encryption: {{ . }}
{{- end }}
maxParallel: {{ $context.wal.maxParallel }}
maxParallel: {{ .wal.maxParallel }}
data:
compression: {{ $context.data.compression }}
{{- with $context.data.encryption }}
compression: {{ .data.compression }}
{{- with .data.encryption }}
encryption: {{ . }}
{{- end }}
jobs: {{ $context.data.jobs }}
jobs: {{ .data.jobs }}
s3Credentials:
accessKeyId:
{{- if not (empty $context.endpointCredentials) }}
name: {{ $context.endpointCredentials }}
{{- if not (empty .endpointCredentials) }}
name: {{ .endpointCredentials }}
{{- else }}
name: {{- printf "%s-backup-secret" (include "cluster.name" $context) | trunc 63 | trimSuffix "-" -}}
{{- end }}
key: ACCESS_KEY_ID
secretAccessKey:
{{- if not (empty $context.endpointCredentials) }}
name: {{ $context.endpointCredentials }}
{{- if .endpointCredentials }}
name: {{ .endpointCredentials }}
{{- else }}
name: {{- printf "%s-backup-secret" (include "cluster.name" $context) | trunc 63 | trimSuffix "-" -}}
{{- end }}

View File

@@ -5,21 +5,21 @@
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: "{{ include "cluster.name" $context }}-{{ $context.name }}-scheduled-backup"
name: "{{ include "cluster.name" $context }}-{{ .name }}-scheduled-backup"
namespace: {{ include "cluster.namespace" $context }}
labels:
{{- include "cluster.labels" $context | nindent 4 }}
spec:
immediate: true
suspend: {{ $context.suspend }}
schedule: {{ $context.schedule | quote }}
backupOwnerReference: {{ $context.backupOwnerReference }}
suspend: {{ .suspend }}
schedule: {{ .schedule | quote }}
backupOwnerReference: {{ .backupOwnerReference }}
cluster:
name: {{ include "cluster.name" $context }}-cluster
method: plugin
pluginConfiguration:
name: {{ $context.plugin }}
name: {{ .plugin }}
parameters:
barmanObjectName: "{{ include "cluster.name" $context }}-{{ $context.backupName }}-backup"
barmanObjectName: "{{ include "cluster.name" $context }}-{{ .backupName }}-backup"
{{ end -}}
{{ end }}