From 665659097d67f17e8f4c5618d5afdd95bea7559e Mon Sep 17 00:00:00 2001 From: Pat White Date: Thu, 29 Oct 2026 23:30:42 -0700 Subject: [PATCH] helm: mount existingClaim data and logs volumes for filer and master (#12234) filer.data, filer.logs and master.logs accept type existingClaim and render the pod volume for it, but the volumeMount (and, for logs, -logdir) only covered hostPath, persistentVolumeClaim and emptyDir. With filer.data.type=existingClaim the claim was attached to the pod but never mounted, so the filer kept its metadata store on the container's own filesystem and lost it on every restart. admin and worker already include existingClaim in the same conditions. Adds a helm_ci check that renders both StatefulSets with existingClaim and asserts the mounts and -logdir. Co-authored-by: Pat White <5015863+patwhite@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- .github/workflows/helm_ci.yml | 16 ++++++++++++++++ .../templates/filer/filer-statefulset.yaml | 6 +++--- .../templates/master/master-statefulset.yaml | 4 ++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/helm_ci.yml b/.github/workflows/helm_ci.yml index cd18fc22c4..d62153e608 100644 --- a/.github/workflows/helm_ci.yml +++ b/.github/workflows/helm_ci.yml @@ -599,6 +599,22 @@ jobs: --set master.data.storageClass=standard > /tmp/pvc.yaml grep -q "PersistentVolumeClaim" /tmp/pvc.yaml echo "PVC configuration renders correctly" + + echo "=== Testing existingClaim volumes are mounted ===" + # The filer's data and logs and the master's logs declared an existingClaim + # volume but mounted only hostPath, persistentVolumeClaim and emptyDir, so + # the filer kept its metadata store on the container's own filesystem. + helm template test $CHART_DIR --show-only templates/filer/filer-statefulset.yaml \ + --set filer.data.type=existingClaim --set filer.data.claimName=filer-data \ + --set filer.logs.type=existingClaim --set filer.logs.claimName=filer-logs > /tmp/filer-existing-claim.yaml + grep -A 1 -- '- name: data-filer$' /tmp/filer-existing-claim.yaml | grep -q 'mountPath: /data$' + grep -A 1 -- '- name: seaweedfs-filer-log-volume$' /tmp/filer-existing-claim.yaml | grep -q 'mountPath: "/logs/"$' + grep -q -- '-logdir=/logs' /tmp/filer-existing-claim.yaml + helm template test $CHART_DIR --show-only templates/master/master-statefulset.yaml \ + --set master.logs.type=existingClaim --set master.logs.claimName=master-logs > /tmp/master-existing-claim.yaml + grep -A 1 -- '- name: seaweedfs-master-log-volume$' /tmp/master-existing-claim.yaml | grep -q 'mountPath: "/logs/"$' + grep -q -- '-logdir=/logs' /tmp/master-existing-claim.yaml + echo "existingClaim volumes are mounted" echo "=== Testing with custom replicas ===" helm template test $CHART_DIR \ diff --git a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml index 97276773b5..6db270a365 100644 --- a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml @@ -209,7 +209,7 @@ spec: - "-ec" - | exec /usr/bin/weed \ - {{- if or (eq .Values.filer.logs.type "hostPath") (eq .Values.filer.logs.type "persistentVolumeClaim") (eq .Values.filer.logs.type "emptyDir") }} + {{- if or (eq .Values.filer.logs.type "hostPath") (eq .Values.filer.logs.type "persistentVolumeClaim") (eq .Values.filer.logs.type "emptyDir") (eq .Values.filer.logs.type "existingClaim") }} -logdir=/logs \ {{- else }} -logtostderr=true \ @@ -284,7 +284,7 @@ spec: {{- end }} volumeMounts: {{- include "seaweedfs.tmpDirVolumeMount" (list . .Values.filer.containerSecurityContext (tpl (.Values.filer.extraVolumeMounts | default "") .) (tpl (.Values.filer.extraVolumes | default "") .)) | nindent 12 }} - {{- if (or (eq .Values.filer.logs.type "hostPath") (eq .Values.filer.logs.type "persistentVolumeClaim") (eq .Values.filer.logs.type "emptyDir")) }} + {{- if (or (eq .Values.filer.logs.type "hostPath") (eq .Values.filer.logs.type "persistentVolumeClaim") (eq .Values.filer.logs.type "emptyDir") (eq .Values.filer.logs.type "existingClaim")) }} - name: seaweedfs-filer-log-volume mountPath: "/logs/" {{- end }} @@ -293,7 +293,7 @@ spec: mountPath: /etc/sw readOnly: true {{- end }} - {{- if (or .Values.filer.enablePVC (or (eq .Values.filer.data.type "hostPath") (eq .Values.filer.data.type "persistentVolumeClaim") (eq .Values.filer.data.type "emptyDir"))) }} + {{- if (or .Values.filer.enablePVC (or (eq .Values.filer.data.type "hostPath") (eq .Values.filer.data.type "persistentVolumeClaim") (eq .Values.filer.data.type "emptyDir") (eq .Values.filer.data.type "existingClaim"))) }} - name: data-filer mountPath: /data {{- end }} diff --git a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml index 0b4fc38058..87f015637e 100644 --- a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml @@ -117,7 +117,7 @@ spec: - "-ec" - | exec /usr/bin/weed \ - {{- if or (eq .Values.master.logs.type "hostPath") (eq .Values.master.logs.type "persistentVolumeClaim") (eq .Values.master.logs.type "emptyDir") }} + {{- if or (eq .Values.master.logs.type "hostPath") (eq .Values.master.logs.type "persistentVolumeClaim") (eq .Values.master.logs.type "emptyDir") (eq .Values.master.logs.type "existingClaim") }} -logdir=/logs \ {{- else }} -logtostderr=true \ @@ -184,7 +184,7 @@ spec: {{- include "seaweedfs.tmpDirVolumeMount" (list . .Values.master.containerSecurityContext (tpl (.Values.master.extraVolumeMounts | default "") .) (tpl (.Values.master.extraVolumes | default "") .)) | nindent 12 }} - name : data-{{ .Release.Namespace }} mountPath: /data - {{- if or (eq .Values.master.logs.type "hostPath") (eq .Values.master.logs.type "persistentVolumeClaim") (eq .Values.master.logs.type "emptyDir") }} + {{- if or (eq .Values.master.logs.type "hostPath") (eq .Values.master.logs.type "persistentVolumeClaim") (eq .Values.master.logs.type "emptyDir") (eq .Values.master.logs.type "existingClaim") }} - name: seaweedfs-master-log-volume mountPath: "/logs/" {{- end }}