_persistence.tpl 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{- define "filebrowser.persistence" -}}
  2. {{- $configBasePath := "/config" }}
  3. persistence:
  4. config:
  5. enabled: true
  6. {{- include "filebrowser.storage.ci.migration" (dict "storage" .Values.filebrowserStorage.config) }}
  7. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.filebrowserStorage.config) | nindent 4 }}
  8. targetSelector:
  9. filebrowser:
  10. filebrowser:
  11. mountPath: {{ $configBasePath }}
  12. 02-init-config:
  13. mountPath: {{ $configBasePath }}
  14. {{- if and (eq .Values.filebrowserStorage.config.type "ixVolume")
  15. (not (.Values.filebrowserStorage.config.ixVolumeConfig | default dict).aclEnable) }}
  16. 01-permissions:
  17. mountPath: /mnt/directories/config
  18. {{- end }}
  19. {{- if not .Values.filebrowserStorage.additionalStorages -}}
  20. {{- fail "Filebrowser - Expected at least 1 additional storage" -}}
  21. {{- end -}}
  22. {{- range $idx, $storage := .Values.filebrowserStorage.additionalStorages }}
  23. {{- if not (hasPrefix "/" $storage.mountPath) -}}
  24. {{- fail (printf "Filebrowser - Expected [Mount Path] to start with [/], but got [%v]" $storage.mountPath) -}}
  25. {{- end }}
  26. {{ printf "filebrowser-%v:" (int $idx) }}
  27. enabled: true
  28. {{- include "filebrowser.storage.ci.migration" (dict "storage" $storage) }}
  29. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  30. targetSelector:
  31. filebrowser:
  32. filebrowser:
  33. mountPath: /data{{ $storage.mountPath }}
  34. {{- if and (eq $storage.type "ixVolume") (not ($storage.ixVolumeConfig | default dict).aclEnable) }}
  35. 01-permissions:
  36. mountPath: /mnt/directories{{ $storage.mountPath }}
  37. {{- end }}
  38. {{- end }}
  39. {{/* Certificate */}}
  40. {{- with .Values.filebrowserNetwork.certificateID }}
  41. cert:
  42. enabled: true
  43. type: secret
  44. objectName: filebrowser-cert
  45. defaultMode: "0600"
  46. items:
  47. - key: tls.key
  48. path: tls.key
  49. - key: tls.crt
  50. path: tls.crt
  51. targetSelector:
  52. filebrowser:
  53. filebrowser:
  54. mountPath: {{ $configBasePath }}/certs
  55. readOnly: true
  56. scaleCertificate:
  57. filebrowser-cert:
  58. enabled: true
  59. id: {{ . }}
  60. {{- end -}}
  61. {{- end -}}
  62. {{/* TODO: Remove on the next version bump, eg 1.2.0+ */}}
  63. {{- define "filebrowser.storage.ci.migration" -}}
  64. {{- $storage := .storage -}}
  65. {{- if $storage.hostPath -}}
  66. {{- $_ := set $storage "hostPathConfig" dict -}}
  67. {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
  68. {{- end -}}
  69. {{- end -}}