_filebrowser.tpl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {{- define "filebrowser.workload" -}}
  2. {{- $configBasePath := "/config" -}}
  3. {{- $scheme := "http" }}
  4. workload:
  5. filebrowser:
  6. enabled: true
  7. primary: true
  8. type: Deployment
  9. podSpec:
  10. hostNetwork: {{ .Values.filebrowserNetwork.hostNetwork }}
  11. containers:
  12. filebrowser:
  13. enabled: true
  14. primary: true
  15. imageSelector: image
  16. securityContext:
  17. runAsUser: {{ .Values.filebrowserRunAs.user }}
  18. runAsGroup: {{ .Values.filebrowserRunAs.group }}
  19. args:
  20. - --config
  21. - {{ $configBasePath }}/filebrowser.json
  22. - --database
  23. - {{ $configBasePath }}/filebrowser.db
  24. - --port
  25. - "{{ .Values.filebrowserNetwork.webPort }}"
  26. - --address
  27. - "0.0.0.0"
  28. - --root
  29. - /data
  30. {{- if .Values.filebrowserNetwork.certificateID }}
  31. - --cert
  32. - {{ $configBasePath }}/certs/tls.crt
  33. - --key
  34. - {{ $configBasePath }}/certs/tls.key
  35. {{- $scheme = "https" -}}
  36. {{- end -}}
  37. {{ with .Values.filebrowserConfig.additionalEnvs }}
  38. envList:
  39. {{ range $env := . }}
  40. - name: {{ $env.name }}
  41. value: {{ $env.value }}
  42. {{ end }}
  43. {{ end }}
  44. probes:
  45. liveness:
  46. enabled: true
  47. type: {{ $scheme }}
  48. port: "{{ .Values.filebrowserNetwork.webPort }}"
  49. path: /health
  50. readiness:
  51. enabled: true
  52. type: {{ $scheme }}
  53. port: "{{ .Values.filebrowserNetwork.webPort }}"
  54. path: /health
  55. startup:
  56. enabled: true
  57. type: {{ $scheme }}
  58. port: "{{ .Values.filebrowserNetwork.webPort }}"
  59. path: /health
  60. initContainers:
  61. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  62. "UID" .Values.filebrowserRunAs.user
  63. "GID" .Values.filebrowserRunAs.group
  64. "mode" "check"
  65. "type" "install") | nindent 8 }}
  66. 02-init-config:
  67. enabled: true
  68. type: init
  69. imageSelector: image
  70. securityContext:
  71. runAsUser: {{ .Values.filebrowserRunAs.user }}
  72. runAsGroup: {{ .Values.filebrowserRunAs.group }}
  73. # Creating the config file if it doesn't exist
  74. # This will make the container to log
  75. # "Using config file: {{ $configBasePath }}/filebrowser.json"
  76. # on startup, so users know where the config is, in case they need it.
  77. # Arguments will take precedence over the config file always.
  78. # (Like the port, paths, etc we set above.)
  79. command:
  80. - /bin/sh
  81. - -c
  82. - |
  83. if [ ! -f {{ $configBasePath }}/filebrowser.json ]; then
  84. echo "Creating an empty config file"
  85. echo '{}' > {{ $configBasePath }}/filebrowser.json
  86. fi
  87. {{- end -}}