_syncthing.tpl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{- define "syncthing.workload" -}}
  2. workload:
  3. syncthing:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.syncthingNetwork.hostNetwork }}
  9. securityContext:
  10. fsGroup: {{ .Values.syncthingID.group }}
  11. containers:
  12. syncthing:
  13. enabled: true
  14. primary: true
  15. imageSelector: image
  16. securityContext:
  17. runAsUser: 0
  18. runAsGroup: 0
  19. runAsNonRoot: false
  20. readOnlyRootFilesystem: false
  21. # This is needed to allow syncthing assign
  22. # PCAPs to its child processes
  23. allowPrivilegeEscalation: true
  24. capabilities:
  25. add:
  26. - FOWNER
  27. - DAC_OVERRIDE
  28. - CHOWN
  29. - SETUID
  30. - SETGID
  31. - SETFCAP
  32. - SETPCAP
  33. - SYS_ADMIN
  34. env:
  35. PCAP: cap_sys_admin,cap_chown,cap_dac_override,cap_fowner+ep
  36. STGUIADDRESS: "0.0.0.0:{{ .Values.syncthingNetwork.webPort }}"
  37. # Set a custom override for the GUI assets
  38. STGUIASSETS: /var/truenas/assets/gui
  39. # Disable automatic upgrades
  40. STNOUPGRADE: "true"
  41. fixedEnv:
  42. PUID: {{ .Values.syncthingID.user }}
  43. {{ with .Values.syncthingConfig.additionalEnvs }}
  44. envList:
  45. {{ range $env := . }}
  46. - name: {{ $env.name }}
  47. value: {{ $env.value }}
  48. {{ end }}
  49. {{ end }}
  50. probes:
  51. liveness:
  52. enabled: true
  53. type: http
  54. path: /rest/noauth/health
  55. port: "{{ .Values.syncthingNetwork.webPort }}"
  56. readiness:
  57. enabled: true
  58. type: http
  59. path: /rest/noauth/health
  60. port: "{{ .Values.syncthingNetwork.webPort }}"
  61. startup:
  62. enabled: true
  63. type: http
  64. path: /rest/noauth/health
  65. port: "{{ .Values.syncthingNetwork.webPort }}"
  66. # We use this hook as we need the API
  67. # to be running when we run the configure script
  68. lifecycle:
  69. postStart:
  70. type: exec
  71. command:
  72. - su-exec
  73. - "{{ .Values.syncthingID.user }}:{{ .Values.syncthingID.group }}"
  74. - /configure.sh
  75. {{- if .Values.syncthingNetwork.certificateID }}
  76. initContainers:
  77. {{- include "syncthing.certContainer" $ | nindent 8 -}}
  78. {{- end }}
  79. {{- end -}}