feat: change template formatting
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
{{- define "cluster.bootstrap" -}}
|
||||
|
||||
{{- define "cluster.bootstrap" }}
|
||||
{{- if eq .Values.mode "standalone" }}
|
||||
bootstrap:
|
||||
initdb:
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- with (omit . "postInitApplicationSQL" "owner" "import") }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (omit . "postInitApplicationSQL" "owner" "import") }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.cluster.initdb.owner }}
|
||||
owner: {{ tpl .Values.cluster.initdb.owner . }}
|
||||
@@ -14,20 +13,18 @@ bootstrap:
|
||||
{{- if (.Values.cluster.initdb.postInitApplicationSQL) }}
|
||||
postInitApplicationSQL:
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- range .postInitApplicationSQL }}
|
||||
{{- printf "- %s" . | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- range .postInitApplicationSQL }}
|
||||
{{- printf "- %s" . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- else if eq .Values.mode "recovery" -}}
|
||||
{{- else if eq .Values.mode "recovery" }}
|
||||
bootstrap:
|
||||
|
||||
{{- if eq .Values.recovery.method "import" }}
|
||||
initdb:
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- with (omit . "owner" "import" "postInitApplicationSQL") }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.cluster.initdb.owner }}
|
||||
@@ -66,7 +63,6 @@ bootstrap:
|
||||
pgRestoreExtraOptions:
|
||||
{{- . | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
{{- else if eq .Values.recovery.method "backup" }}
|
||||
recovery:
|
||||
{{- with .Values.recovery.backup.pitrTarget.time }}
|
||||
@@ -81,7 +77,6 @@ bootstrap:
|
||||
{{- end }}
|
||||
backup:
|
||||
name: {{ .Values.recovery.backup.backupName }}
|
||||
|
||||
{{- else if eq .Values.recovery.method "objectStore" }}
|
||||
recovery:
|
||||
{{- with .Values.recovery.objectStore.pitrTarget.time }}
|
||||
@@ -95,13 +90,10 @@ bootstrap:
|
||||
owner: {{ . }}
|
||||
{{- end }}
|
||||
source: {{ include "cluster.recoveryServerName" . }}
|
||||
|
||||
{{- else }}
|
||||
{{- else }}
|
||||
{{ fail "Invalid recovery mode!" }}
|
||||
{{- end }}
|
||||
|
||||
{{- else }}
|
||||
{{- else }}
|
||||
{{ fail "Invalid cluster mode!" }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- define "cluster.externalClusters" -}}
|
||||
{{- define "cluster.externalClusters" }}
|
||||
{{- if eq .Values.mode "standalone" }}
|
||||
{{- else if eq .Values.mode "recovery" }}
|
||||
externalClusters:
|
||||
@@ -18,4 +18,4 @@ externalClusters:
|
||||
{{- else }}
|
||||
{{ fail "Invalid cluster mode!" }}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -30,4 +30,4 @@
|
||||
name: {{ $config.sslRootCertSecret.name }}
|
||||
key: {{ $config.sslRootCertSecret.key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{ if and (eq .Values.backup.method "objectStore") (.Values.backup.externalSecret.enabled) }}
|
||||
{{ $context := . -}}
|
||||
{{ range .Values.backup.objectStore -}}
|
||||
{{- if and (eq .Values.backup.method "objectStore") (.Values.backup.externalSecret.enabled) }}
|
||||
{{- $context := . }}
|
||||
{{- range .Values.backup.objectStore }}
|
||||
---
|
||||
apiVersion: external-secrets.io/v1
|
||||
kind: ExternalSecret
|
||||
@@ -30,8 +30,8 @@ spec:
|
||||
remoteRef:
|
||||
key: {{ .externalSecretCredentialPath| required "External Secret Credential local path is required" }}
|
||||
property: ACCESS_SECRET_KEY
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and (eq .Values.recovery.method "objectStore") (.Values.recovery.objectStore.externalSecret.enabled) }}
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{ if (eq .Values.backup.method "objectStore") }}
|
||||
{{ $context := . -}}
|
||||
{{ range .Values.backup.objectStore -}}
|
||||
{{- if (eq .Values.backup.method "objectStore") }}
|
||||
{{- $context := . }}
|
||||
{{- range .Values.backup.objectStore }}
|
||||
---
|
||||
apiVersion: barmancloud.cnpg.io/v1
|
||||
kind: ObjectStore
|
||||
@@ -57,10 +57,9 @@ spec:
|
||||
region:
|
||||
name: {{ include "cluster.backupSecretName" (dict "instance" . "global" $context) }}
|
||||
key: ACCESS_REGION
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Values.recovery.method "objectStore" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.recovery.method "objectStore" }}
|
||||
---
|
||||
apiVersion: barmancloud.cnpg.io/v1
|
||||
kind: ObjectStore
|
||||
@@ -104,4 +103,4 @@ spec:
|
||||
region:
|
||||
name: {{ include "cluster.recoverySecretName" . }}
|
||||
key: ACCESS_REGION
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.podMonitor.enabled -}}
|
||||
{{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.podMonitor.enabled }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
@@ -15,4 +15,4 @@ spec:
|
||||
cnpg.io/podRole: instance
|
||||
podMetricsEndpoints:
|
||||
- port: metrics
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -47,6 +47,6 @@ spec:
|
||||
{{- end }}
|
||||
{{- with .template }}
|
||||
template:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{ . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.prometheusRule.enabled -}}
|
||||
{{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.prometheusRule.enabled }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
@@ -26,4 +26,4 @@ spec:
|
||||
- {{ $tpl }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ $context := . -}}
|
||||
{{ range .Values.backup.scheduledBackups -}}
|
||||
{{- $context := . }}
|
||||
{{- range .Values.backup.scheduledBackups }}
|
||||
---
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: ScheduledBackup
|
||||
@@ -21,4 +21,4 @@ spec:
|
||||
name: {{ .plugin | default "barman-cloud.cloudnative-pg.io" }}
|
||||
parameters:
|
||||
barmanObjectName: "{{ include "cluster.name" $context }}-backup-{{ .backupName }}"
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user