_persistence.tpl 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {{- define "syncthing.persistence" -}}
  2. persistence:
  3. home:
  4. enabled: true
  5. {{- include "syncthing.storage.ci.migration" (dict "storage" .Values.syncthingStorage.home) }}
  6. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.syncthingStorage.home) | nindent 4 }}
  7. targetSelector:
  8. syncthing:
  9. syncthing:
  10. mountPath: /var/syncthing
  11. 01-certs:
  12. mountPath: /var/syncthing
  13. configure:
  14. enabled: true
  15. type: configmap
  16. objectName: syncthing-configure
  17. defaultMode: "0770"
  18. targetSelector:
  19. syncthing:
  20. syncthing:
  21. mountPath: /configure.sh
  22. subPath: configure.sh
  23. truenas-logo:
  24. enabled: true
  25. type: configmap
  26. objectName: syncthing-truenas-logo
  27. defaultMode: "0770"
  28. targetSelector:
  29. syncthing:
  30. syncthing:
  31. mountPath: /var/truenas/assets/gui/default/assets/img/logo-horizontal.svg
  32. subPath: logo-horizontal.svg
  33. {{- if not .Values.syncthingStorage.additionalStorages -}}
  34. {{- fail "Syncthing - Expected at least one additional storage defined" -}}
  35. {{- end -}}
  36. {{- range $idx, $storage := .Values.syncthingStorage.additionalStorages }}
  37. {{- if eq $storage.type "smb-pv-pvc" -}}
  38. {{- if $storage.smbConfig.migrationMode -}}
  39. {{- $_ := set $storage "readOnly" true -}}
  40. {{- $_ := set $storage.smbConfig "mountOptions" (list
  41. (dict "key" "noperm")
  42. (dict "key" "cifsacl")
  43. (dict "key" "vers" "value" "3.0")
  44. ) -}}
  45. {{- end -}}
  46. {{- end }}
  47. {{ printf "sync-%v" (int $idx) }}:
  48. enabled: true
  49. {{- include "syncthing.storage.ci.migration" (dict "storage" $storage) }}
  50. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  51. targetSelector:
  52. syncthing:
  53. syncthing:
  54. mountPath: {{ $storage.mountPath }}
  55. {{- end }}
  56. {{- if .Values.syncthingNetwork.certificateID }}
  57. certs:
  58. enabled: true
  59. type: secret
  60. objectName: syncthing-cert
  61. defaultMode: "0600"
  62. items:
  63. - key: tls.key
  64. path: https-key.pem
  65. - key: tls.crt
  66. path: https-cert.pem
  67. targetSelector:
  68. syncthing:
  69. 01-certs:
  70. mountPath: /certs
  71. readOnly: true
  72. scaleCertificate:
  73. syncthing-cert:
  74. enabled: true
  75. id: {{ .Values.syncthingNetwork.certificateID }}
  76. {{- end -}}
  77. {{- end -}}
  78. {{/* TODO: CI only migration, remove on next version bump*/}}
  79. {{- define "syncthing.storage.ci.migration" -}}
  80. {{- $storage := .storage -}}
  81. {{- if $storage.hostPath -}}
  82. {{- $_ := set $storage "hostPathConfig" dict -}}
  83. {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
  84. {{- end -}}
  85. {{- end -}}