Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| cluster.monitoring.podMonitor.relabelings | list | `[]` | The list of relabelings for the PodMonitor. Applied to samples before scraping. |
| cluster.monitoring.prometheusRule.enabled | bool | `true` | Whether to enable the PrometheusRule automated alerts |
| cluster.monitoring.prometheusRule.excludeRules | list | `[]` | Exclude specified rules |
| cluster.plugins | list | `[]` | The plugins configuration, containing any plugin to be loaded with the corresponding configuration |
| cluster.postgresGID | int | `-1` | The GID of the postgres user inside the image, defaults to 26 |
| cluster.postgresUID | int | `-1` | The UID of the postgres user inside the image, defaults to 26 |
| cluster.postgresql.ldap | object | `{}` | PostgreSQL LDAP configuration (see https://cloudnative-pg.io/documentation/current/postgresql_conf/#ldap-configuration) |
Expand Down
2 changes: 2 additions & 0 deletions charts/cluster/templates/_backup.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{- if .Values.backups.enabled }}
backup:
target: "prefer-standby"
{{ if (eq (include "cluster.useBarmanCloudPlugin" .) "false") }}
retentionPolicy: {{ .Values.backups.retentionPolicy }}
barmanObjectStore:
wal:
Expand All @@ -19,5 +20,6 @@ backup:

{{- $d := dict "chartFullname" (include "cluster.fullname" .) "scope" .Values.backups "secretPrefix" "backup" }}
{{- include "cluster.barmanObjectStoreConfig" $d | nindent 2 }}
{{- end}}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,19 @@ Postgres GID
{{- 26 -}}
{{- end -}}
{{- end -}}


{{/*
Check if barman-cloud plugin exists and is enabled
*/}}
{{- define "cluster.useBarmanCloudPlugin" -}}
{{- $hasPlugin := false }}
{{- if .Values.cluster.plugins }}
{{- range .Values.cluster.plugins }}
{{- if and (eq .name "barman-cloud.cloudnative-pg.io") .enabled }}
{{- $hasPlugin = true }}
{{- end }}
{{- end }}
{{- end }}
{{- $hasPlugin }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ spec:
name: {{ . }}
{{ end }}
enablePDB: {{ .Values.cluster.enablePDB }}
{{- with .Values.cluster.plugins }}
plugins:
{{- toYaml . | nindent 4}}
{{- end }}
postgresql:
{{- if or (eq .Values.type "timescaledb") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }}
shared_preload_libraries:
Expand Down
22 changes: 22 additions & 0 deletions charts/cluster/templates/objectStore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ if and (eq (include "cluster.useBarmanCloudPlugin" .) "true") .Values.backups.enabled }}
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: {{ include "cluster.fullname" $ }}-object-store
spec:
configuration:
wal:
compression: {{ .Values.backups.wal.compression }}
{{- if .Values.backups.wal.encryption }}
encryption: {{ .Values.backups.wal.encryption }}
{{- end }}
maxParallel: {{ .Values.backups.wal.maxParallel }}
data:
compression: {{ .Values.backups.data.compression }}
{{- if .Values.backups.data.encryption }}
encryption: {{ .Values.backups.data.encryption }}
{{- end }}
jobs: {{ .Values.backups.data.jobs }}
{{- $d := dict "chartFullname" (include "cluster.fullname" .) "scope" .Values.backups "secretPrefix" "backup" -}}
{{- include "cluster.barmanObjectStoreConfig" $d | indent 2 }}
{{- end }}
8 changes: 7 additions & 1 deletion charts/cluster/templates/scheduled-backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ metadata:
spec:
immediate: true
schedule: {{ .schedule | quote }}
method: {{ .method }}
backupOwnerReference: {{ .backupOwnerReference }}
cluster:
name: {{ include "cluster.fullname" $context }}
{{- if (eq (include "cluster.useBarmanCloudPlugin" $context ) "true") }}
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
method: plugin
{{ else }}
method: {{ .method }}
{{- end }}
{{ end -}}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ spec:
memory: 256Mi
limits:
cpu: 100m
memory: 256Mi
memory: 256Mi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing spaces after memory: 256Mi

plugins:
- name: cnpg-i-plugin-example.my-org.io
enabled: true
parameters:
key1: value1
key2: value2
priorityClassName: mega-high
primaryUpdateStrategy: supervised
primaryUpdateMethod: restart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ cluster:
inRoles:
- pg_monitor
- pg_signal_backend
plugins:
- name: cnpg-i-plugin-example.my-org.io
enabled: true
parameters:
key1: value1
key2: value2
postgresql:
ldap:
server: 'openldap.default.svc.cluster.local'
Expand Down
21 changes: 21 additions & 0 deletions charts/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,27 @@
}
}
},
"plugins": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"isWALArchiver": {
"type": "boolean"
},
"parameters": {
"type": "object"
}
},
"required": ["name"]
}
},
"postgresGID": {
"type": "integer"
},
Expand Down
7 changes: 7 additions & 0 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ cluster:
# - name: custom-queries-secret
# key: custom-queries

plugins: []
# - name: cnpg-i-plugin-example.my-org.io
# enabled: true
# parameters:
# key1: value1
# key2: value2

postgresql:
# -- PostgreSQL configuration options (postgresql.conf)
parameters: {}
Expand Down