From c6a6668e5ec14e8c28e8458009118359ebaf04d7 Mon Sep 17 00:00:00 2001 From: Alex Lebens Date: Sun, 17 May 2026 20:32:48 -0500 Subject: [PATCH] feat: change template formatting --- charts/postgres-cluster/Chart.yaml | 4 +- charts/postgres-cluster/README.md | 2 +- charts/postgres-cluster/template.yaml | 346 ++++++++++++++++++ .../postgres-cluster/templates/_bootstrap.tpl | 30 +- .../templates/_external_clusters.tpl | 4 +- .../templates/_external_source_cluster.tpl | 2 +- .../templates/external-secret.yaml | 10 +- .../templates/object-store.yaml | 15 +- .../templates/pod-monitor.yaml | 4 +- .../postgres-cluster/templates/poolers.yaml | 2 +- .../templates/prometheus-rule.yaml | 4 +- .../templates/scheduled-backup.yaml | 6 +- 12 files changed, 383 insertions(+), 46 deletions(-) create mode 100644 charts/postgres-cluster/template.yaml diff --git a/charts/postgres-cluster/Chart.yaml b/charts/postgres-cluster/Chart.yaml index 15bab83..de398fc 100644 --- a/charts/postgres-cluster/Chart.yaml +++ b/charts/postgres-cluster/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: postgres-cluster -version: 7.13.0 +version: 7.13.1 description: Cloudnative-pg Cluster keywords: - database @@ -12,4 +12,4 @@ maintainers: - name: alexlebens icon: https://avatars.githubusercontent.com/u/100373852?s=48&v=4 # renovate: datasource=github-releases depName=cloudnative-pg/cloudnative-pg -appVersion: v1.29.0 +appVersion: v1.29.1 diff --git a/charts/postgres-cluster/README.md b/charts/postgres-cluster/README.md index c518e62..f081bbe 100644 --- a/charts/postgres-cluster/README.md +++ b/charts/postgres-cluster/README.md @@ -1,6 +1,6 @@ # postgres-cluster -![Version: 7.13.0](https://img.shields.io/badge/Version-7.13.0-informational?style=flat-square) ![AppVersion: v1.29.0](https://img.shields.io/badge/AppVersion-v1.29.0-informational?style=flat-square) +![Version: 7.13.1](https://img.shields.io/badge/Version-7.13.1-informational?style=flat-square) ![AppVersion: v1.29.1](https://img.shields.io/badge/AppVersion-v1.29.1-informational?style=flat-square) Cloudnative-pg Cluster diff --git a/charts/postgres-cluster/template.yaml b/charts/postgres-cluster/template.yaml new file mode 100644 index 0000000..44c2519 --- /dev/null +++ b/charts/postgres-cluster/template.yaml @@ -0,0 +1,346 @@ +--- +# Source: postgres-cluster/templates/cluster.yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: release-name-postgresql-18-cluster + namespace: gitea + labels: + app.kubernetes.io/name: release-name-postgresql-18-cluster + helm.sh/chart: postgres-cluster-7.13.1 + app.kubernetes.io/instance: release-name + app.kubernetes.io/part-of: release-name + app.kubernetes.io/version: "7.13.1" + app.kubernetes.io/managed-by: Helm +spec: + instances: 3 + imageName: "ghcr.io/cloudnative-pg/postgresql:18.3-standard-trixie" + imagePullPolicy: IfNotPresent + postgresUID: 26 + postgresGID: 26 + storage: + size: 10Gi + storageClass: local-path + walStorage: + size: 2Gi + storageClass: local-path + resources: + limits: + hugepages-2Mi: 256Mi + requests: + cpu: 20m + memory: 80Mi + affinity: + enablePodAntiAffinity: true + topologyKey: kubernetes.io/hostname + primaryUpdateMethod: switchover + primaryUpdateStrategy: unsupervised + logLevel: info + enableSuperuserAccess: false + enablePDB: true + postgresql: + parameters: + hot_standby_feedback: "on" + max_slot_wal_keep_size: 2000MB + shared_buffers: 128MB + monitoring: + enablePodMonitor: false + disableDefaultQueries: false + + bootstrap: + initdb: + database: app + owner: app +--- +# Source: postgres-cluster/templates/pod-monitor.yaml +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: release-name-postgresql-18 + namespace: gitea + labels: + app.kubernetes.io/name: release-name-postgresql-18 + helm.sh/chart: postgres-cluster-7.13.1 + app.kubernetes.io/instance: release-name + app.kubernetes.io/part-of: release-name + app.kubernetes.io/version: "7.13.1" + app.kubernetes.io/managed-by: Helm +spec: + selector: + matchLabels: + cnpg.io/cluster: release-name-postgresql-18 + cnpg.io/podRole: instance + podMetricsEndpoints: + - port: metrics +--- +# Source: postgres-cluster/templates/prometheus-rule.yaml +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: release-name-postgresql-18-alert-rules + namespace: gitea + labels: + app.kubernetes.io/name: release-name-postgresql-18-alert-rules + helm.sh/chart: postgres-cluster-7.13.1 + app.kubernetes.io/instance: release-name + app.kubernetes.io/part-of: release-name + app.kubernetes.io/version: "7.13.1" + app.kubernetes.io/managed-by: Helm +spec: + groups: + - name: cloudnative-pg/release-name-postgresql-18 + rules: + - alert: CNPGClusterBackendsWaitingWarning + annotations: + summary: CNPG Cluster a backend is waiting for longer than 5 minutes. + description: |- + Pod {{ $labels.pod }} + has been waiting for longer than 5 minutes + expr: | + cnpg_backends_waiting_total{namespace="gitea"} > 300 + for: 1m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterDatabaseDeadlockConflictsWarning + annotations: + summary: CNPG Cluster has over 10 deadlock conflicts. + description: |- + There are over 10 deadlock conflicts in + {{ $labels.pod }} + expr: | + cnpg_pg_stat_database_deadlocks{namespace="gitea"} > 10 + for: 1m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterHACritical + annotations: + summary: CNPG Cluster has no standby replicas! + description: |- + CloudNativePG Cluster "{{`{{`}} $labels.job {{`}}`}}" has no ready standby replicas. Your cluster at a severe + risk of data loss and downtime if the primary instance fails. + + The primary instance is still online and able to serve queries, although connections to the `-ro` endpoint + will fail. The `-r` endpoint os operating at reduced capacity and all traffic is being served by the main. + + This can happen during a normal fail-over or automated minor version upgrades in a cluster with 2 or less + instances. The replaced instance may need some time to catch-up with the cluster primary instance. + + This alarm will be always trigger if your cluster is configured to run with only 1 instance. In this + case you may want to silence it. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHACritical.md + expr: | + max by (job) (cnpg_pg_replication_streaming_replicas{namespace="gitea"} - cnpg_pg_replication_is_wal_receiver_up{namespace="gitea"}) < 1 + for: 5m + labels: + severity: critical + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterHAWarning + annotations: + summary: CNPG Cluster less than 2 standby replicas. + description: |- + CloudNativePG Cluster "{{`{{`}} $labels.job {{`}}`}}" has only {{`{{`}} $value {{`}}`}} standby replicas, putting + your cluster at risk if another instance fails. The cluster is still able to operate normally, although + the `-ro` and `-r` endpoints operate at reduced capacity. + + This can happen during a normal fail-over or automated minor version upgrades. The replaced instance may + need some time to catch-up with the cluster primary instance. + + This alarm will be constantly triggered if your cluster is configured to run with less than 3 instances. + In this case you may want to silence it. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHAWarning.md + expr: | + max by (job) (cnpg_pg_replication_streaming_replicas{namespace="gitea"} - cnpg_pg_replication_is_wal_receiver_up{namespace="gitea"}) < 2 + for: 5m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterHighConnectionsCritical + annotations: + summary: CNPG Instance maximum number of connections critical! + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" instance {{`{{`}} $labels.pod {{`}}`}} is using {{`{{`}} $value {{`}}`}}% of + the maximum number of connections. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHighConnectionsCritical.md + expr: | + sum by (pod) (cnpg_backends_total{namespace="gitea", pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) / max by (pod) (cnpg_pg_settings_setting{name="max_connections", namespace="gitea", pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) * 100 > 95 + for: 5m + labels: + severity: critical + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterHighConnectionsWarning + annotations: + summary: CNPG Instance is approaching the maximum number of connections. + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" instance {{`{{`}} $labels.pod {{`}}`}} is using {{`{{`}} $value {{`}}`}}% of + the maximum number of connections. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHighConnectionsWarning.md + expr: | + sum by (pod) (cnpg_backends_total{namespace="gitea", pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) / max by (pod) (cnpg_pg_settings_setting{name="max_connections", namespace="gitea", pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) * 100 > 80 + for: 5m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterHighReplicationLag + annotations: + summary: CNPG Cluster high replication lag + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" is experiencing a high replication lag of + {{`{{`}} $value {{`}}`}}ms. + + High replication lag indicates network issues, busy instances, slow queries or suboptimal configuration. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHighReplicationLag.md + expr: | + max(cnpg_pg_replication_lag{namespace="gitea",pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) * 1000 > 1000 + for: 5m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterInstancesOnSameNode + annotations: + summary: CNPG Cluster instances are located on the same node. + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" has {{`{{`}} $value {{`}}`}} + instances on the same node {{`{{`}} $labels.node {{`}}`}}. + + A failure or scheduled downtime of a single node will lead to a potential service disruption and/or data loss. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterInstancesOnSameNode.md + expr: | + count by (node) (kube_pod_info{namespace="gitea", pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) > 1 + for: 5m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterLongRunningTransactionWarning + annotations: + summary: CNPG Cluster query is taking longer than 5 minutes. + description: |- + CloudNativePG Cluster Pod {{ $labels.pod }} + is taking more than 5 minutes (300 seconds) for a query. + expr: |- + cnpg_backends_max_tx_duration_seconds{namespace="gitea"} > 300 + for: 1m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterLowDiskSpaceCritical + annotations: + summary: CNPG Instance is running out of disk space! + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" is running extremely low on disk space. Check attached PVCs! + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterLowDiskSpaceCritical.md + expr: | + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"} / kubelet_volume_stats_capacity_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"})) > 0.9 OR + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-wal"} / kubelet_volume_stats_capacity_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-wal"})) > 0.9 OR + max(sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + / + sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + * + on(namespace, persistentvolumeclaim) group_left(volume) + kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"} + ) > 0.9 + for: 5m + labels: + severity: critical + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterLowDiskSpaceWarning + annotations: + summary: CNPG Instance is running out of disk space. + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" is running low on disk space. Check attached PVCs. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterLowDiskSpaceWarning.md + expr: | + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"} / kubelet_volume_stats_capacity_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"})) > 0.7 OR + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-wal"} / kubelet_volume_stats_capacity_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-wal"})) > 0.7 OR + max(sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + / + sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace="gitea", persistentvolumeclaim=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + * + on(namespace, persistentvolumeclaim) group_left(volume) + kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"} + ) > 0.7 + for: 5m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterOffline + annotations: + summary: CNPG Cluster has no running instances! + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" has no ready instances. + + Having an offline cluster means your applications will not be able to access the database, leading to + potential service disruption and/or data loss. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterOffline.md + expr: | + (count(cnpg_collector_up{namespace="gitea",pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"}) OR on() vector(0)) == 0 + for: 5m + labels: + severity: critical + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterPGDatabaseXidAgeWarning + annotations: + summary: CNPG Cluster has a number of transactions from the frozen XID to the current one. + description: |- + Over 300,000,000 transactions from frozen xid + on pod {{ $labels.pod }} + expr: | + cnpg_pg_database_xid_age{namespace="gitea"} > 300000000 + for: 1m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterPGReplicationWarning + annotations: + summary: CNPG Cluster standby is lagging behind the primary. + description: |- + Standby is lagging behind by over 300 seconds (5 minutes) + expr: | + cnpg_pg_replication_lag{namespace="gitea"} > 300 + for: 1m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterReplicaFailingReplicationWarning + annotations: + summary: CNPG Cluster has a replica is failing to replicate. + description: |- + Replica {{ $labels.pod }} + is failing to replicate + expr: | + cnpg_pg_replication_in_recovery{namespace="gitea"} > cnpg_pg_replication_is_wal_receiver_up{namespace="gitea"} + for: 1m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster + - alert: CNPGClusterZoneSpreadWarning + annotations: + summary: CNPG Cluster instances in the same zone. + description: |- + CloudNativePG Cluster "gitea/release-name-postgresql-18-cluster" has instances in the same availability zone. + + A disaster in one availability zone will lead to a potential service disruption and/or data loss. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterZoneSpreadWarning.md + expr: | + 3 > count(count by (label_topology_kubernetes_io_zone) (kube_pod_info{namespace="gitea", pod=~"release-name-postgresql-18-cluster-([1-9][0-9]*)$"} * on(node,instance) group_left(label_topology_kubernetes_io_zone) kube_node_labels)) < 3 + for: 5m + labels: + severity: warning + namespace: gitea + cnpg_cluster: release-name-postgresql-18-cluster diff --git a/charts/postgres-cluster/templates/_bootstrap.tpl b/charts/postgres-cluster/templates/_bootstrap.tpl index 68315a2..af1d39b 100644 --- a/charts/postgres-cluster/templates/_bootstrap.tpl +++ b/charts/postgres-cluster/templates/_bootstrap.tpl @@ -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 }} diff --git a/charts/postgres-cluster/templates/_external_clusters.tpl b/charts/postgres-cluster/templates/_external_clusters.tpl index 4ed6c1e..7b07c51 100644 --- a/charts/postgres-cluster/templates/_external_clusters.tpl +++ b/charts/postgres-cluster/templates/_external_clusters.tpl @@ -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 }} diff --git a/charts/postgres-cluster/templates/_external_source_cluster.tpl b/charts/postgres-cluster/templates/_external_source_cluster.tpl index 6d21e20..e06afbf 100644 --- a/charts/postgres-cluster/templates/_external_source_cluster.tpl +++ b/charts/postgres-cluster/templates/_external_source_cluster.tpl @@ -30,4 +30,4 @@ name: {{ $config.sslRootCertSecret.name }} key: {{ $config.sslRootCertSecret.key }} {{- end }} -{{- end }} +{{- end -}} diff --git a/charts/postgres-cluster/templates/external-secret.yaml b/charts/postgres-cluster/templates/external-secret.yaml index 95981bb..74a6f87 100644 --- a/charts/postgres-cluster/templates/external-secret.yaml +++ b/charts/postgres-cluster/templates/external-secret.yaml @@ -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) }} --- diff --git a/charts/postgres-cluster/templates/object-store.yaml b/charts/postgres-cluster/templates/object-store.yaml index 271a948..b0264ef 100644 --- a/charts/postgres-cluster/templates/object-store.yaml +++ b/charts/postgres-cluster/templates/object-store.yaml @@ -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 }} diff --git a/charts/postgres-cluster/templates/pod-monitor.yaml b/charts/postgres-cluster/templates/pod-monitor.yaml index 4d083a9..4d3e729 100644 --- a/charts/postgres-cluster/templates/pod-monitor.yaml +++ b/charts/postgres-cluster/templates/pod-monitor.yaml @@ -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 }} diff --git a/charts/postgres-cluster/templates/poolers.yaml b/charts/postgres-cluster/templates/poolers.yaml index 560f6bd..a8f76d5 100644 --- a/charts/postgres-cluster/templates/poolers.yaml +++ b/charts/postgres-cluster/templates/poolers.yaml @@ -47,6 +47,6 @@ spec: {{- end }} {{- with .template }} template: - {{- . | toYaml | nindent 4 }} + {{ . | toYaml | nindent 4 }} {{- end }} {{- end }} diff --git a/charts/postgres-cluster/templates/prometheus-rule.yaml b/charts/postgres-cluster/templates/prometheus-rule.yaml index beb0d59..b357ef1 100644 --- a/charts/postgres-cluster/templates/prometheus-rule.yaml +++ b/charts/postgres-cluster/templates/prometheus-rule.yaml @@ -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 }} diff --git a/charts/postgres-cluster/templates/scheduled-backup.yaml b/charts/postgres-cluster/templates/scheduled-backup.yaml index 3ab9987..acb8300 100644 --- a/charts/postgres-cluster/templates/scheduled-backup.yaml +++ b/charts/postgres-cluster/templates/scheduled-backup.yaml @@ -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 }}