diff --git a/apps-helm/samba4/conf/smb.conf b/apps-helm/samba4/conf/smb.conf index cc7ffcc..7c18ccf 100755 --- a/apps-helm/samba4/conf/smb.conf +++ b/apps-helm/samba4/conf/smb.conf @@ -33,4 +33,12 @@ browseable = {{ .browseable | default "yes" }} writable = {{ .writable | default "yes" }} {{- end }} -;EOF way past actual end of file \ No newline at end of file + +{{ if .Values.persistence.combineShares }}{{ range .Values.persistence.sharesToCombine }} +[{{ .destName }}] + path = /combined/{{ .destName }} + comment = Magic combined share + browseable = yes + writable = yes +{{- end }}{{ end }} +;EOF way past actual end of file diff --git a/apps-helm/samba4/templates/deployment.yaml b/apps-helm/samba4/templates/deployment.yaml index 8ebd424..2ec4636 100644 --- a/apps-helm/samba4/templates/deployment.yaml +++ b/apps-helm/samba4/templates/deployment.yaml @@ -40,6 +40,28 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} containers: +{{- if .Values.persistence.combineShares }} + - name: overlaymagic + image: busybox + command: + - /bin/sh + - -c + - -- + args: + {{- range .Values.persistence.sharesToCombine }} + - mkdir -p /combined/{{ .destName }}; + mkdir -p /data/overlay-{{ .destName }}; + mount -t overlay -o lowerdir={{ join ":" .shares }},upperdir=/data/overlay-{{ .destName }}-upper,workdir=/data/overlay/{{ .destName }}-work overlay /combined/{{ .destName }}; + sleep infinity; + {{- end }} + lifecycle: + preStop: + exec: + command: + - /bin/sh + - -c + - {{ range .Values.persistence.sharesToCombine }}umount /combined/{{ .destName }}; {{- end }} +{{- end }} - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" command: @@ -173,4 +195,4 @@ spec: persistentVolumeClaim: claimName: {{ $fullName }}-{{ .name }} {{- end }} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/apps-helm/samba4/values.yaml b/apps-helm/samba4/values.yaml index fa4771b..ea70b0e 100644 --- a/apps-helm/samba4/values.yaml +++ b/apps-helm/samba4/values.yaml @@ -38,6 +38,10 @@ persistence: other: emptyDir: {} extraPVCShares: [] + combineShares: false + sharesToCombine: + - destName: "" + shares: [] privatePersistence: enabled: false