From ff80650b85561e4ea4df2585f1086fedcba45af8 Mon Sep 17 00:00:00 2001 From: Peter Dodd Date: Wed, 25 Nov 2026 21:13:58 +0000 Subject: [PATCH] feat(helm): optional volumeAttributesClassName on every PVC (#12996) * feat(helm): optional volumeAttributesClassName on every PVC The chart's claims only take storageClass, size and annotations, so provisioned performance (IOPS/throughput on GKE Hyperdisk, EBS gp3, Azure Premium v2) can only be set through a custom StorageClass. A VolumeAttributesClass is the Kubernetes way to do that and can be changed later without recreating the volume. Every claim the chart renders now takes an optional volumeAttributesClassName next to its storageClass: master.data/logs, filer.data/logs and the deprecated filer.volumeAttributesClassName, admin.data/logs, volume.dataDirs[]/idx/logs (and volumes.), and allInOne.data. It is rendered only when set, so default renders are unchanged. Co-Authored-By: Claude Opus 5.5 * helm: quote volumeAttributesClassName so names like 2026 or null stay strings Co-Authored-By: Claude Opus 5.5 * helm: say existing claims need a patch to change their volumeAttributesClassName Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: Chris Lu --- .github/workflows/helm_ci.yml | 20 +++++++++++++++++++ k8s/charts/seaweedfs/README.md | 12 +++++++++++ .../templates/admin/admin-statefulset.yaml | 6 ++++++ .../templates/all-in-one/all-in-one-pvc.yaml | 3 +++ .../templates/filer/filer-statefulset.yaml | 9 +++++++++ .../templates/master/master-statefulset.yaml | 6 ++++++ .../templates/volume/volume-statefulset.yaml | 9 +++++++++ k8s/charts/seaweedfs/values.yaml | 15 ++++++++++++++ 8 files changed, 80 insertions(+) diff --git a/.github/workflows/helm_ci.yml b/.github/workflows/helm_ci.yml index 1a126ebfe4..bc94e0a597 100644 --- a/.github/workflows/helm_ci.yml +++ b/.github/workflows/helm_ci.yml @@ -162,6 +162,26 @@ jobs: done echo "shareProcessNamespace renders correctly" + echo "=== Testing volumeAttributesClassName ===" + pvc_args=(--set allInOne.enabled=true --set allInOne.data.type=persistentVolumeClaim + --set admin.enabled=true --set admin.allowInsecureBind=true --set volume.dataDirs[0].name=data1) + for claim in master.data master.logs filer.data filer.logs admin.data admin.logs \ + volume.idx volume.logs volume.dataDirs[0]; do + pvc_args+=(--set "$claim.type=persistentVolumeClaim" --set "$claim.size=1Gi") + done + helm template test $CHART_DIR "${pvc_args[@]}" > /tmp/vac-default.yaml + test "$(grep -c 'volumeAttributesClassName' /tmp/vac-default.yaml)" -eq 0 + for claim in master.data master.logs filer.data filer.logs admin.data admin.logs \ + volume.idx volume.logs volume.dataDirs[0] allInOne.data; do + pvc_args+=(--set "$claim.volumeAttributesClassName=fast") + done + helm template test $CHART_DIR "${pvc_args[@]}" > /tmp/vac.yaml + test "$(grep -c '^ *volumeAttributesClassName: "fast"$' /tmp/vac.yaml)" -eq 10 + helm template test $CHART_DIR --set master.data.type=persistentVolumeClaim \ + --set-string master.data.volumeAttributesClassName=null > /tmp/vac-null.yaml + grep -q '^ *volumeAttributesClassName: "null"$' /tmp/vac-null.yaml + echo "volumeAttributesClassName renders correctly" + echo "=== Testing the S3 config reloader ===" for workload in filer.s3:templates/filer/filer-statefulset.yaml s3:templates/s3/s3-deployment.yaml; do prefix=${workload%%:*} diff --git a/k8s/charts/seaweedfs/README.md b/k8s/charts/seaweedfs/README.md index 3b90ae1572..796abd12b6 100644 --- a/k8s/charts/seaweedfs/README.md +++ b/k8s/charts/seaweedfs/README.md @@ -122,6 +122,18 @@ https://github.com/rancher/local-path-provisioner you can use ANY storage class you like, just update the correct storage-class for your deployment. +Every claim the chart creates also takes an optional `volumeAttributesClassName` +next to its `storageClass` (for example `master.data.volumeAttributesClassName` +or `volume.dataDirs[].volumeAttributesClassName`), to set provisioned +performance such as IOPS and throughput through a +[VolumeAttributesClass](https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/). +It needs Kubernetes 1.34+, or 1.31+ with the `VolumeAttributesClass` feature gate. +`volumeClaimTemplates` cannot be changed on an existing StatefulSet, and a new +template only reaches claims created after it. To set it on a release that +already exists, patch `spec.volumeAttributesClassName` on each existing claim, +and delete the StatefulSet with `--cascade=orphan` before the upgrade so the +upgrade can apply the new template. + ### Master data: hostPath vs a claim The master's `-mdir` holds its Raft log and snapshots, and with them the diff --git a/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml b/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml index a4aa2bf31b..11c575e166 100644 --- a/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml @@ -359,6 +359,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ .Values.admin.data.storageClass }} + {{- with .Values.admin.data.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.admin.data.size }} @@ -373,6 +376,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ .Values.admin.logs.storageClass }} + {{- with .Values.admin.logs.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.admin.logs.size }} diff --git a/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-pvc.yaml b/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-pvc.yaml index af7e5dbe82..efc32cd84f 100644 --- a/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-pvc.yaml +++ b/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-pvc.yaml @@ -22,6 +22,9 @@ spec: {{- if .Values.allInOne.data.storageClass }} storageClassName: {{ .Values.allInOne.data.storageClass }} {{- end }} + {{- with .Values.allInOne.data.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.allInOne.data.size | default "10Gi" }} diff --git a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml index f2c776f341..a8d427683c 100644 --- a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml @@ -510,6 +510,9 @@ spec: {{- if .Values.filer.storageClass }} storageClassName: {{ .Values.filer.storageClass }} {{- end }} + {{- with .Values.filer.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} {{- end }} {{- $pvc_exists := include "seaweedfs.filer.pvc_exists" . -}} {{- if $pvc_exists }} @@ -526,6 +529,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ .Values.filer.data.storageClass }} + {{- with .Values.filer.data.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.filer.data.size }} @@ -542,6 +548,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ .Values.filer.logs.storageClass }} + {{- with .Values.filer.logs.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.filer.logs.size }} diff --git a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml index 2228d70378..80a71e711d 100644 --- a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml @@ -340,6 +340,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ .Values.master.data.storageClass }} + {{- with .Values.master.data.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.master.data.size }} @@ -356,6 +359,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ .Values.master.logs.storageClass }} + {{- with .Values.master.logs.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.master.logs.size }} diff --git a/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml index 971c69ee28..2fad359f2c 100644 --- a/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml @@ -412,6 +412,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ $dir.storageClass }} + {{- with $dir.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ $dir.size }} @@ -430,6 +433,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ $volume.idx.storageClass }} + {{- with $volume.idx.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ $volume.idx.size }} @@ -446,6 +452,9 @@ spec: spec: accessModes: [ "ReadWriteOnce" ] storageClassName: {{ $volume.logs.storageClass }} + {{- with $volume.logs.volumeAttributesClassName }} + volumeAttributesClassName: {{ . | quote }} + {{- end }} resources: requests: storage: {{ $volume.logs.size }} diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index 9b82d4299c..0166b428d7 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -151,12 +151,14 @@ master: # Enter any extra configuration for master.toml here. # It may be a multi-line string. + # volumeAttributesClassName (optional) needs Kubernetes 1.34+, or 1.31+ with the VolumeAttributesClass feature gate. # You may use ANY storage-class, example with local-path-provisioner # Annotations are optional. # data: # type: "persistentVolumeClaim" # size: "24Ti" # storageClass: "local-path-provisioner" + # volumeAttributesClassName: "my-attributes-class" # annotations: # "key": "value" # @@ -184,6 +186,7 @@ master: # type: "persistentVolumeClaim" # size: "24Ti" # storageClass: "local-path-provisioner" + # volumeAttributesClassName: "my-attributes-class" # annotations: # "key": "value" @@ -416,6 +419,7 @@ volume: # extraArgs: ["-customFlag", "value", "-anotherFlag"] extraArgs: [] + # volumeAttributesClassName (optional) needs Kubernetes 1.34+, or 1.31+ with the VolumeAttributesClass feature gate. # For each data disk you may use ANY storage-class, example with local-path-provisioner # Annotations are optional. # dataDirs: @@ -423,6 +427,7 @@ volume: # type: "persistentVolumeClaim" # size: "24Ti" # storageClass: "local-path-provisioner" + # volumeAttributesClassName: "my-attributes-class" # annotations: # "key": "value" # maxVolumes: 0 # If set to zero on non-windows OS, the limit will be auto configured. (default "7") @@ -477,6 +482,7 @@ volume: # type: "persistentVolumeClaim" # size: "20Gi" # storageClass: "local-path-provisioner" + # volumeAttributesClassName: "my-attributes-class" # # or # @@ -799,12 +805,16 @@ filer: storage: 25Gi # storageClass is the class of storage which defaults to null (the Kube cluster will pick the default). storageClass: null + # volumeAttributesClassName is the VolumeAttributesClass of the enablePVC claim; null leaves it unset. + volumeAttributesClassName: null + # volumeAttributesClassName (optional) needs Kubernetes 1.34+, or 1.31+ with the VolumeAttributesClass feature gate. # You may use ANY storage-class, example with local-path-provisioner # Annotations are optional. # data: # type: "persistentVolumeClaim" # size: "24Ti" # storageClass: "local-path-provisioner" + # volumeAttributesClassName: "my-attributes-class" # annotations: # "key": "value" # @@ -828,6 +838,7 @@ filer: # type: "persistentVolumeClaim" # size: "24Ti" # storageClass: "local-path-provisioner" + # volumeAttributesClassName: "my-attributes-class" # annotations: # "key": "value" @@ -1633,10 +1644,12 @@ admin: extraArgs: [] # Storage configuration + # volumeAttributesClassName (optional) needs Kubernetes 1.34+, or 1.31+ with the VolumeAttributesClass feature gate. data: type: "emptyDir" # Options: "hostPath", "persistentVolumeClaim", "emptyDir", "existingClaim" size: "10Gi" storageClass: "" + volumeAttributesClassName: "" hostPathPrefix: /storage claimName: "" annotations: {} @@ -1645,6 +1658,7 @@ admin: type: "emptyDir" # Options: "hostPath", "persistentVolumeClaim", "emptyDir", "existingClaim" size: "5Gi" storageClass: "" + volumeAttributesClassName: "" hostPathPrefix: /storage claimName: "" annotations: {} @@ -2140,6 +2154,7 @@ allInOne: claimName: seaweedfs-data-pvc # Name of the PVC to use (for existingClaim type) size: null # Size of the PVC (null defaults to 10Gi for persistentVolumeClaim type) storageClass: null # Storage class for the PVC (null uses cluster default) + volumeAttributesClassName: null # VolumeAttributesClass for the PVC; needs Kubernetes 1.34+, or 1.31+ with the feature gate # accessModes for the PVC. Default is ["ReadWriteOnce"]. # For multi-replica deployments, use ["ReadWriteMany"] with a compatible storage class. accessModes: []