_zerotier.tpl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {{- define "zerotier.workload" -}}
  2. workload:
  3. zerotier:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.zerotierNetwork.hostNetwork }}
  9. sysctls:
  10. - name: net.ipv4.ip_forward
  11. value: "1"
  12. - name: net.ipv6.conf.all.forwarding
  13. value: "1"
  14. containers:
  15. zerotier:
  16. enabled: true
  17. primary: true
  18. imageSelector: image
  19. args:
  20. {{ if not .Values.zerotierConfig.networks }}
  21. {{ fail "Zerotier - At least one network must be specified" }}
  22. {{ end }}
  23. {{ range .Values.zerotierConfig.networks }}
  24. - {{ . }}
  25. {{ end }}
  26. securityContext:
  27. runAsUser: 0
  28. runAsGroup: 0
  29. runAsNonRoot: false
  30. readOnlyRootFilesystem: false
  31. capabilities:
  32. add:
  33. {{/* Most of those capabilities are normally added by default in conainers
  34. But by default, in common, we drop all of them. So here we add some of them
  35. as they are needed, because zerotier starts as root but drops privs for some
  36. of the processes running by the zerotier binary */}}
  37. - AUDIT_WRITE
  38. - CHOWN
  39. - DAC_OVERRIDE
  40. - FOWNER
  41. - NET_ADMIN
  42. - NET_BIND_SERVICE
  43. - NET_RAW
  44. - SETGID
  45. - SETPCAP
  46. - SETUID
  47. - SYS_ADMIN
  48. env:
  49. {{ with .Values.zerotierConfig.authToken }}
  50. ZEROTIER_API_SECRET: {{ . }}
  51. {{ end }}
  52. {{ with .Values.zerotierConfig.identityPublic }}
  53. ZEROTIER_IDENTITY_PUBLIC: {{ . }}
  54. {{ end }}
  55. {{ with .Values.zerotierConfig.identitySecret }}
  56. ZEROTIER_IDENTITY_SECRET: {{ . }}
  57. {{ end }}
  58. {{ with .Values.zerotierConfig.additionalEnvs }}
  59. envList:
  60. {{ range $env := . }}
  61. - name: {{ $env.name }}
  62. value: {{ $env.value }}
  63. {{ end }}
  64. {{ end }}
  65. probes:
  66. liveness:
  67. enabled: true
  68. type: exec
  69. command: /healthcheck.sh
  70. readiness:
  71. enabled: true
  72. type: exec
  73. command: /healthcheck.sh
  74. startup:
  75. enabled: true
  76. type: exec
  77. command: /healthcheck.sh
  78. {{/* Persistence */}}
  79. persistence:
  80. tun-dev:
  81. enabled: true
  82. type: device
  83. hostPath: /dev/net/tun
  84. targetSelector:
  85. zerotier:
  86. zerotier:
  87. mountPath: /dev/net/tun
  88. {{- end -}}