@@ -343,6 +343,39 @@ Swift as primary object store env vars
343343{{- end -}}
344344
345345
346+ {{/*
347+ Volumes for a pod, which needs access to nextcloud data.
348+ */ }}
349+ {{- define " nextcloud.volumes" -}}
350+ - name: nextcloud-main
351+ {{- if .Values.persistence.enabled }}
352+ persistentVolumeClaim:
353+ claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template " nextcloud.fullname" . }}-nextcloud{{- end }}
354+ {{- else }}
355+ emptyDir: {}
356+ {{- end }}
357+ {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
358+ - name: nextcloud-data
359+ persistentVolumeClaim:
360+ claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template " nextcloud.fullname" . }}-nextcloud-data{{- end }}
361+ {{- end }}
362+ {{- if .Values.nextcloud.configs }}
363+ - name: nextcloud-config
364+ configMap:
365+ name: {{ template " nextcloud.fullname" . }}-config
366+ {{- end }}
367+ {{- if .Values.nextcloud.phpConfigs }}
368+ - name: nextcloud-phpconfig
369+ configMap:
370+ name: {{ template " nextcloud.fullname" . }}-phpconfig
371+ {{- end }}
372+ {{- with .Values.nextcloud.extraVolumes }}
373+ {{- toYaml . }}
374+ {{- end }}
375+ {{- end -}}
376+
377+
378+
346379{{/*
347380Create volume mounts for the nextcloud container as well as the cron sidecar container.
348381*/ }}
@@ -374,11 +407,13 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con
374407- name: nextcloud-main
375408 mountPath: /var/www/html /themes
376409 subPath: {{ ternary " themes" (printf " %s /themes" .Values.nextcloud.persistence.subPath ) (empty .Values.nextcloud.persistence.subPath ) }}
410+
377411{{- range $key , $value := .Values.nextcloud.configs }}
378412- name: nextcloud-config
379413 mountPath: /var/www/html /config/{{ $key }}
380414 subPath: {{ $key }}
381- {{- end }}
415+ {{- end }}{{/* end-range configs */ }}
416+
382417{{- if .Values.nextcloud.configs }}
383418{{- range $key , $value := .Values.nextcloud.defaultConfigs }}
384419{{- if $value }}
@@ -387,14 +422,17 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con
387422 subPath: {{ $key }}
388423{{- end }}
389424{{- end }}
390- {{- end }}
391- {{- if .Values.nextcloud.extraVolumeMounts }}
392- {{ toYaml .Values.nextcloud.extraVolumeMounts }}
393- {{- end }}
425+ {{- end }}{{/* end-if .configs (also defaultConfigs beside config, see above) */ }}
426+
427+ {{- with .Values.nextcloud.extraVolumeMounts }}
428+ {{ toYaml . }}
429+ {{- end }}{{/* end-with extraVolumes*/ }}
430+
394431{{- $nginxEnabled := .Values.nginx.enabled -}}
395432{{- range $key , $value := .Values.nextcloud.phpConfigs }}
396433- name: nextcloud-phpconfig
397434 mountPath: {{ $nginxEnabled | ternary (printf " /usr/local/etc/php-fpm.d/%s " $key | quote) (printf " /usr/local/etc/php/conf.d/%s " $key | quote) }}
398435 subPath: {{ $key }}
399- {{- end }}
436+ {{- end }}{{/* end-range phpconfig (with nginx) */ }}
437+
400438{{- end -}}
0 commit comments