From c7d9729bd7308f95e5bdbff67276b619412309e6 Mon Sep 17 00:00:00 2001 From: Davide Perozzi Date: Mon, 5 May 2025 14:37:38 +0200 Subject: [PATCH] feat(cluster): add pvcTemplate to storage config --- charts/cluster/templates/cluster.yaml | 8 ++++++++ charts/cluster/values.yaml | 29 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index a2cd09853b..0cc181dc1f 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -27,12 +27,20 @@ spec: {{- if not (empty .Values.cluster.storage.storageClass) }} storageClass: {{ .Values.cluster.storage.storageClass }} {{- end }} + {{- if .Values.cluster.storage.pvcTemplate }} + pvcTemplate: + {{- toYaml .Values.cluster.storage.pvcTemplate | nindent 6 }} + {{- end }} {{- if .Values.cluster.walStorage.enabled }} walStorage: size: {{ .Values.cluster.walStorage.size }} {{- if not (empty .Values.cluster.walStorage.storageClass) }} storageClass: {{ .Values.cluster.walStorage.storageClass }} {{- end }} + {{- if .Values.cluster.walStorage.pvcTemplate }} + pvcTemplate: + {{- toYaml .Values.cluster.walStorage.pvcTemplate | nindent 6 }} + {{- end }} {{- end }} {{- with .Values.cluster.resources }} resources: diff --git a/charts/cluster/values.yaml b/charts/cluster/values.yaml index 9b5009acfc..f72ee315ed 100644 --- a/charts/cluster/values.yaml +++ b/charts/cluster/values.yaml @@ -204,11 +204,40 @@ cluster: storage: size: 8Gi storageClass: "" + # -- Custom pvc template. Defining this makes size and storageClass redundant + # See: https://cloudnative-pg.io/documentation/1.25/cloudnative-pg.v1/#postgresql-cnpg-io-v1-StorageConfiguration:~:text=pvcTemplate + # Def: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#persistentvolumeclaimspec-v1-core + # + # pvcTemplate: + # storageClassName: "" + # selector: + # matchLabels: + # provided-for: custom-label-to-select-pv + # accessModes: + # - ReadWriteOnce + # resources: + # requests: + # storage: 8Gi + walStorage: enabled: false size: 1Gi storageClass: "" + # -- Custom pvc template. Defining this makes size and storageClass redundant + # See: https://cloudnative-pg.io/documentation/1.25/cloudnative-pg.v1/#postgresql-cnpg-io-v1-StorageConfiguration:~:text=pvcTemplate + # Def: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#persistentvolumeclaimspec-v1-core + # + # pvcTemplate: + # storageClassName: "" + # selector: + # matchLabels: + # provided-for: custom-label-to-select-pv + # accessModes: + # - ReadWriteOnce + # resources: + # requests: + # storage: 8Gi # -- The UID of the postgres user inside the image, defaults to 26 postgresUID: -1