fix(seaweedfs): keep storage class names strings in the volume claims

The upstream admin and volume StatefulSets write storageClassName
unquoted, so a class name made only of digits, which Kubernetes allows
and the parent chart now hands on as a string, turned back into a
number there and the claim was rejected. The field is quoted, and left
out when no class is named: quoting an empty value would set an empty
storageClassName, which disables dynamic provisioning instead of using
the cluster default. Upstream 4.52 and master still write both fields
unquoted, so this is a chart patch, applied with --forward so make
update stops once upstream carries an equivalent change.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
This commit is contained in:
Alexey Artamonov committed 2026-11-11 02:18:50 +03:00
1 parent 7c9aa2fe10
commit e7b5a5a1a9
6 files changed
+105 -2

No files matched your search

+1
View File
@@ -66,6 +66,7 @@ update:
# fail here, where BSD patch would otherwise reverse it and remove the
# section without an error.
patch --forward --no-backup-if-mismatch -p4 < patches/s3-grpc-tls.patch
patch --forward --no-backup-if-mismatch -p4 < patches/storage-class-string.patch
#patch --no-backup-if-mismatch -p4 < patches/retention-policy-delete.yaml
$(MAKE) update-image
@@ -330,7 +330,9 @@ spec:
{{- end }}
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.admin.data.storageClass }}
{{- with .Values.admin.data.storageClass }}
storageClassName: {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.admin.data.size }}
@@ -404,7 +404,9 @@ spec:
{{- end }}
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ $dir.storageClass }}
{{- with $dir.storageClass }}
storageClassName: {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ $dir.size }}
@@ -0,0 +1,30 @@
diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/admin/admin-statefulset.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/admin/admin-statefulset.yaml
index ad112981f..b3d070651 100644
--- a/packages/system/seaweedfs/charts/seaweedfs/templates/admin/admin-statefulset.yaml
+++ b/packages/system/seaweedfs/charts/seaweedfs/templates/admin/admin-statefulset.yaml
@@ -330,7 +330,9 @@ spec:
{{- end }}
spec:
accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ .Values.admin.data.storageClass }}
+ {{- with .Values.admin.data.storageClass }}
+ storageClassName: {{ . | quote }}
+ {{- end }}
resources:
requests:
storage: {{ .Values.admin.data.size }}
diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/volume/volume-statefulset.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/volume/volume-statefulset.yaml
index 04011d1d6..0702d703e 100644
--- a/packages/system/seaweedfs/charts/seaweedfs/templates/volume/volume-statefulset.yaml
+++ b/packages/system/seaweedfs/charts/seaweedfs/templates/volume/volume-statefulset.yaml
@@ -404,7 +404,9 @@ spec:
{{- end }}
spec:
accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ $dir.storageClass }}
+ {{- with $dir.storageClass }}
+ storageClassName: {{ . | quote }}
+ {{- end }}
resources:
requests:
storage: {{ $dir.size }}
@@ -147,3 +147,29 @@ tests:
asserts:
- notExists:
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
# The parent hands the class on as a string, and a class name may be all
# digits; emitted unquoted it turns back into a number the claim rejects.
- it: keeps a numeric admin storage class name a string
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
set:
seaweedfs:
admin:
enabled: true
secret:
existingSecret: seaweedfs-admin-credentials
data:
storageClass: "123"
asserts:
- equal:
path: spec.volumeClaimTemplates[0].spec.storageClassName
value: "123"
# An empty storageClassName disables dynamic provisioning; with no class
# named, the claim must leave the field out so the cluster default applies.
- it: leaves the admin claim on the cluster default when no class is named
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
set: *enabled
asserts:
- notExists:
path: spec.volumeClaimTemplates[0].spec.storageClassName
@@ -0,0 +1,42 @@
suite: seaweedfs volume claims keep the storage class a string
templates:
- charts/seaweedfs/templates/volume/volume-statefulset.yaml
release:
name: seaweedfs-system
namespace: tenant-root
tests:
# The parent hands volume.storageClass on as a string, and a class name may
# be all digits; emitted unquoted it turns back into a number the claim
# rejects.
- it: keeps a numeric volume storage class name a string
set:
seaweedfs:
volume:
dataDirs:
- name: data1
type: persistentVolumeClaim
size: 10Gi
storageClass: "123"
maxVolumes: 0
asserts:
- equal:
path: spec.volumeClaimTemplates[0].spec.storageClassName
value: "123"
# An empty storageClassName disables dynamic provisioning; with no class
# named, the claim must leave the field out so the cluster default applies.
- it: leaves the volume claim on the cluster default when no class is named
set:
seaweedfs:
volume:
dataDirs:
- name: data1
type: persistentVolumeClaim
size: 10Gi
maxVolumes: 0
asserts:
- notExists:
path: spec.volumeClaimTemplates[0].spec.storageClassName