From 5d79ab4faa25c9abbe38b16ea9efc15ebd3c4d2b Mon Sep 17 00:00:00 2001 From: Dorian Karter Date: Tue, 29 Sep 2026 13:58:41 -0500 Subject: [PATCH] feat: allow WAL PVC storage class selection --- Chart.yaml | 2 +- templates/deployment.yaml | 3 +++ test/test.sh | 18 ++++++++++++++++++ test/values-statefulset-storage-class.yaml | 6 ++++++ values.yaml | 3 +++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/values-statefulset-storage-class.yaml diff --git a/Chart.yaml b/Chart.yaml index 4669597..78f3585 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 name: pgdog -version: v0.82 +version: v0.83 appVersion: "v0.1.58" diff --git a/templates/deployment.yaml b/templates/deployment.yaml index b43517b..1131ae3 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -326,6 +326,9 @@ spec: spec: accessModes: - ReadWriteOnce + {{- if hasKey .Values.statefulSet.walPvc "storageClassName" }} + storageClassName: {{ .Values.statefulSet.walPvc.storageClassName | quote }} + {{- end }} resources: requests: storage: {{ .Values.statefulSet.walPvc.size | quote }} diff --git a/test/test.sh b/test/test.sh index ec4f63d..5c9d3a4 100755 --- a/test/test.sh +++ b/test/test.sh @@ -81,5 +81,23 @@ else exit 1 fi +echo "" +echo "==> Validating WAL PVC StorageClass selection..." +wal_pvc_storage_class() { + helm template test-release "$CHART_DIR" -f "$1" "${@:2}" \ + | yq -r 'select(.kind == "StatefulSet") | .spec.volumeClaimTemplates[0].spec.storageClassName' +} + +default_class=$(wal_pvc_storage_class "$TEST_DIR/values-statefulset.yaml") +custom_class=$(wal_pvc_storage_class "$TEST_DIR/values-statefulset-storage-class.yaml") +no_class=$(wal_pvc_storage_class "$TEST_DIR/values-statefulset.yaml" --set 'statefulSet.walPvc.storageClassName=') + +if [ "$default_class" = "null" ] && [ "$custom_class" = "balanced-storage" ] && [ -z "$no_class" ]; then + echo " WAL PVC uses the default, specified, or disabled StorageClass as requested" +else + echo " FAIL: unexpected WAL PVC StorageClass (default=$default_class, custom=$custom_class, disabled=$no_class)" + exit 1 +fi + echo "" echo "==> All tests passed!" diff --git a/test/values-statefulset-storage-class.yaml b/test/values-statefulset-storage-class.yaml new file mode 100644 index 0000000..7f30ccf --- /dev/null +++ b/test/values-statefulset-storage-class.yaml @@ -0,0 +1,6 @@ +# Pin WAL volumes to a StorageClass compatible with the PgDog node pool. +statefulSet: + enabled: true + walPvc: + enabled: true + storageClassName: balanced-storage diff --git a/values.yaml b/values.yaml index 0e803cd..be912f3 100644 --- a/values.yaml +++ b/values.yaml @@ -107,6 +107,9 @@ statefulSet: walPvc: enabled: false size: 1Gi + # Set to a StorageClass compatible with the nodes running PgDog. + # Omit to use the cluster default; set to "" to disable dynamic provisioning. + # storageClassName: balanced-storage # env allows setting custom environment variables on the pgdog container # Note: NODE_ID is automatically generated and cannot be overridden