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 }}