_webdav.tpl 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. {{- define "webdav.workload" -}}
  2. workload:
  3. webdav:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.webdavNetwork.hostNetwork }}
  9. securityContext:
  10. fsGroup: {{ .Values.webdavRunAs.group }}
  11. containers:
  12. webdav:
  13. enabled: true
  14. primary: true
  15. imageSelector: image
  16. securityContext:
  17. runAsUser: {{ .Values.webdavRunAs.user }}
  18. runAsGroup: {{ .Values.webdavRunAs.group }}
  19. envList:
  20. {{ with .Values.webdavConfig.additionalEnvs }}
  21. {{ range $env := . }}
  22. - name: {{ $env.name }}
  23. value: {{ $env.value }}
  24. {{ end }}
  25. {{ end }}
  26. {{ $port := .Values.webdavNetwork.httpPort }}
  27. {{ $scheme := "http" }}
  28. {{ if not .Values.webdavNetwork.http }}
  29. {{ $port = .Values.webdavNetwork.httpsPort }}
  30. {{ $scheme = "https" }}
  31. {{ end }}
  32. probes:
  33. liveness:
  34. enabled: true
  35. type: {{ $scheme }}
  36. path: /health
  37. port: {{ $port }}
  38. {{ if eq .Values.webdavConfig.authType "basic" }}
  39. httpHeaders:
  40. Authorization: Basic {{ (printf "%s:%s" .Values.webdavConfig.username .Values.webdavConfig.password) | b64enc }}
  41. {{ end }}
  42. readiness:
  43. enabled: true
  44. type: {{ $scheme }}
  45. path: /health
  46. port: {{ $port }}
  47. {{ if eq .Values.webdavConfig.authType "basic" }}
  48. httpHeaders:
  49. Authorization: Basic {{ (printf "%s:%s" .Values.webdavConfig.username .Values.webdavConfig.password) | b64enc }}
  50. {{ end }}
  51. startup:
  52. enabled: true
  53. type: {{ $scheme }}
  54. path: /health
  55. port: {{ $port }}
  56. {{ if eq .Values.webdavConfig.authType "basic" }}
  57. httpHeaders:
  58. Authorization: Basic {{ (printf "%s:%s" .Values.webdavConfig.username .Values.webdavConfig.password) | b64enc }}
  59. {{ end }}
  60. initContainers:
  61. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  62. "UID" .Values.webdavRunAs.user
  63. "GID" .Values.webdavRunAs.group
  64. "mode" "check"
  65. "type" "init") | nindent 8 }}
  66. {{/* Service */}}
  67. service:
  68. webdav:
  69. enabled: true
  70. primary: true
  71. type: NodePort
  72. targetSelector: webdav
  73. ports:
  74. http:
  75. enabled: {{ .Values.webdavNetwork.http }}
  76. primary: true
  77. port: {{ .Values.webdavNetwork.httpPort }}
  78. nodePort: {{ .Values.webdavNetwork.httpPort }}
  79. targetSelector: webdav
  80. https:
  81. enabled: {{ .Values.webdavNetwork.https }}
  82. primary: {{ not .Values.webdavNetwork.http }}
  83. port: {{ .Values.webdavNetwork.httpsPort }}
  84. nodePort: {{ .Values.webdavNetwork.httpsPort }}
  85. targetSelector: webdav
  86. {{/* Persistence */}}
  87. persistence:
  88. httpd-conf:
  89. enabled: true
  90. type: configmap
  91. objectName: config
  92. targetSelector:
  93. webdav:
  94. webdav:
  95. mountPath: /usr/local/apache2/conf/httpd.conf
  96. subPath: httpd.conf
  97. readOnly: true
  98. webdav-conf:
  99. # Mount config only if http is enabled
  100. enabled: {{ .Values.webdavNetwork.http }}
  101. type: configmap
  102. objectName: config
  103. targetSelector:
  104. webdav:
  105. webdav:
  106. mountPath: /usr/local/apache2/conf/Includes/webdav.conf
  107. readOnly: true
  108. subPath: webdav.conf
  109. webdav-ssl-conf:
  110. # Mount config only if https is enabled
  111. enabled: {{ .Values.webdavNetwork.https }}
  112. type: configmap
  113. objectName: config
  114. targetSelector:
  115. webdav:
  116. webdav:
  117. mountPath: /usr/local/apache2/conf/Includes/webdav-ssl.conf
  118. subPath: webdav-ssl.conf
  119. readOnly: true
  120. htauth:
  121. # Mount config only if auth is enabled
  122. enabled: {{ ne .Values.webdavConfig.authType "none" }}
  123. type: secret
  124. objectName: htauth
  125. targetSelector:
  126. webdav:
  127. webdav:
  128. mountPath: /etc/apache2/webdavht{{ .Values.webdavConfig.authType }}
  129. subPath: htauth
  130. readOnly: true
  131. apachelock:
  132. # Stores PID file and DavLockDB file
  133. enabled: true
  134. type: emptyDir
  135. medium: Memory
  136. #TODO: Is this enough?
  137. size: 100Mi
  138. targetSelector:
  139. webdav:
  140. webdav:
  141. mountPath: /usr/local/apache2/var
  142. {{ range $idx, $storage := .Values.webdavStorage.shares }}
  143. {{ printf "webdav-%v" (int $idx) }}:
  144. enabled: {{ $storage.enabled }}
  145. type: hostPath
  146. hostPath: {{ $storage.hostPath }}
  147. targetSelector:
  148. webdav:
  149. webdav:
  150. # This path is used in the Alias directive in the webdav.conf
  151. mountPath: /{{ include "webdav.shares.prefix" $ }}/{{ $storage.name }}
  152. readOnly: {{ $storage.readOnly }}
  153. {{ if $storage.fixPermissions }}
  154. 01-permissions:
  155. mountPath: /mnt/directories/{{ $storage.name }}
  156. readOnly: false
  157. {{ end }}
  158. {{ end }}
  159. {{ if .Values.webdavNetwork.certificateID }}
  160. {{/* Mount Certificate */}}
  161. tls-crt:
  162. enabled: true
  163. type: secret
  164. objectName: webdav-cert
  165. defaultMode: "0600"
  166. targetSelector:
  167. webdav:
  168. webdav:
  169. mountPath: {{ include "webdav.path.cert.crt" $ }}
  170. subPath: tls.crt
  171. readOnly: true
  172. tls-key:
  173. enabled: true
  174. type: secret
  175. objectName: webdav-cert
  176. defaultMode: "0600"
  177. targetSelector:
  178. webdav:
  179. webdav:
  180. mountPath: {{ include "webdav.path.cert.key" $ }}
  181. subPath: tls.key
  182. readOnly: true
  183. {{/* Certificate Secret */}}
  184. scaleCertificate:
  185. webdav-cert:
  186. enabled: true
  187. id: {{ .Values.webdavNetwork.certificateID }}
  188. {{ end }}
  189. {{- end -}}