diff --git a/deploy/charts/alluxio/templates/csi/csi-fuse.yaml b/deploy/charts/alluxio/templates/csi/csi-fuse.yaml index e4273ec14..6aec16164 100644 --- a/deploy/charts/alluxio/templates/csi/csi-fuse.yaml +++ b/deploy/charts/alluxio/templates/csi/csi-fuse.yaml @@ -52,6 +52,20 @@ data: {{ include "alluxio.imagePullSecrets" . | indent 2 }} {{- end}} initContainers: + - name: umount-path + image: {{ .Values.image }}:{{ .Values.imageTag }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + securityContext: + runAsUser: 0 + runAsGroup: 0 + privileged: true # required by bidirectional mount + command: [ "/bin/sh", "-c" ] + args: + - umount -l {{ $alluxioFuseMountPoint }} || true + volumeMounts: + - name: alluxio-fuse-mount + mountPath: {{ $hostMountPath }} + mountPropagation: Bidirectional - name: create-alluxio-fuse-dir image: {{ .Values.image }}:{{ .Values.imageTag }} imagePullPolicy: {{ .Values.imagePullPolicy }} diff --git a/deploy/charts/alluxio/templates/fuse/daemonset.yaml b/deploy/charts/alluxio/templates/fuse/daemonset.yaml index 5c89de4da..c2a2ee6c9 100644 --- a/deploy/charts/alluxio/templates/fuse/daemonset.yaml +++ b/deploy/charts/alluxio/templates/fuse/daemonset.yaml @@ -84,6 +84,20 @@ spec: {{ include "alluxio.imagePullSecrets" . | indent 6 }} {{- end}} initContainers: + - name: umount-path + image: {{ .Values.image }}:{{ .Values.imageTag }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + securityContext: + runAsUser: 0 + runAsGroup: 0 + privileged: true # required by bidirectional mount + command: [ "/bin/sh", "-c" ] + args: + - umount -l {{ $alluxioFuseMountPoint }} || true + volumeMounts: + - name: alluxio-fuse-mount + mountPath: {{ $hostMountPath }} + mountPropagation: Bidirectional - name: path-permission image: {{ .Values.image }}:{{ .Values.imageTag }} imagePullPolicy: {{ .Values.imagePullPolicy }} @@ -129,7 +143,7 @@ spec: {{- end }} command: ["/bin/sh", "-c"] args: - - umount -l -f {{ $alluxioFuseMountPoint }}; + - umount -l {{ $alluxioFuseMountPoint }}; {{- $mountTableSource := get .Values.properties "alluxio.mount.table.source" }} {{- if or (eq $mountTableSource "ETCD") (eq $mountTableSource "STATIC_FILE") }} /entrypoint.sh fuse {{ $alluxioFuseMountPoint }} {{- range .Values.fuse.mountOptions }} -o {{ . }} {{- end }} diff --git a/tests/helm/expectedTemplates/csi/csi-fuse.yaml b/tests/helm/expectedTemplates/csi/csi-fuse.yaml index 514a6c221..79f1e6794 100644 --- a/tests/helm/expectedTemplates/csi/csi-fuse.yaml +++ b/tests/helm/expectedTemplates/csi/csi-fuse.yaml @@ -32,6 +32,20 @@ data: - name: dummySecret1 - name: dummySecret2 initContainers: + - name: umount-path + image: dummy/dummy:dummy + imagePullPolicy: IfNotPresent + securityContext: + runAsUser: 0 + runAsGroup: 0 + privileged: true # required by bidirectional mount + command: [ "/bin/sh", "-c" ] + args: + - umount -l /mnt/alluxio/fuse || true + volumeMounts: + - name: alluxio-fuse-mount + mountPath: /mnt/alluxio + mountPropagation: Bidirectional - name: create-alluxio-fuse-dir image: dummy/dummy:dummy imagePullPolicy: IfNotPresent diff --git a/tests/helm/expectedTemplates/fuse/daemonset.yaml b/tests/helm/expectedTemplates/fuse/daemonset.yaml index c9e861470..5003aaeee 100644 --- a/tests/helm/expectedTemplates/fuse/daemonset.yaml +++ b/tests/helm/expectedTemplates/fuse/daemonset.yaml @@ -96,6 +96,20 @@ spec: - name: dummySecret1 - name: dummySecret2 initContainers: + - name: umount-path + image: dummy/dummy:dummy + imagePullPolicy: IfNotPresent + securityContext: + runAsUser: 0 + runAsGroup: 0 + privileged: true # required by bidirectional mount + command: [ "/bin/sh", "-c" ] + args: + - umount -l /mnt/alluxio/fuse || true + volumeMounts: + - name: alluxio-fuse-mount + mountPath: /mnt/alluxio + mountPropagation: Bidirectional - name: path-permission image: dummy/dummy:dummy imagePullPolicy: IfNotPresent @@ -139,7 +153,7 @@ spec: memory: 1Gi command: ["/bin/sh", "-c"] args: - - umount -l -f /mnt/alluxio/fuse; + - umount -l /mnt/alluxio/fuse; /entrypoint.sh fuse /dummy/dataset/path /mnt/alluxio/fuse -o allow_other -o entry_timeout=3600 -o attr_timeout=3600 env: - name: ALLUXIO_CLIENT_HOSTNAME