_tailscale.tpl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {{- define "tailscale.workload" -}}
  2. {{ include "tailscale.validation" $ }}
  3. workload:
  4. tailscale:
  5. enabled: true
  6. primary: true
  7. type: Deployment
  8. podSpec:
  9. automountServiceAccountToken: true
  10. hostNetwork: {{ .Values.tailscaleNetwork.hostNetwork }}
  11. sysctls:
  12. - name: net.ipv4.ip_forward
  13. value: "1"
  14. - name: net.ipv6.conf.all.forwarding
  15. value: "1"
  16. containers:
  17. tailscale:
  18. enabled: true
  19. primary: true
  20. imageSelector: image
  21. command: /usr/local/bin/containerboot
  22. securityContext:
  23. {{ if .Values.tailscaleConfig.userspace }}
  24. runAsUser: 568
  25. runAsGroup: 568
  26. {{ else }}
  27. runAsUser: 0
  28. runAsGroup: 0
  29. runAsNonRoot: false
  30. {{ end }}
  31. readOnlyRootFilesystem: false
  32. capabilities:
  33. add:
  34. - NET_ADMIN
  35. - NET_RAW
  36. env:
  37. TS_KUBE_SECRET: {{ printf "%s-tailscale-secret" (include "ix.v1.common.lib.chart.names.fullname" .) }}
  38. TS_SOCKET: /var/run/tailscale/tailscaled.sock
  39. TS_USERSPACE: {{ .Values.tailscaleConfig.userspace | quote }}
  40. TS_ACCEPT_DNS: {{ .Values.tailscaleConfig.acceptDns | quote }}
  41. TS_AUTH_ONCE: {{ .Values.tailscaleConfig.authOnce | quote }}
  42. {{ with .Values.tailscaleConfig.advertiseRoutes }}
  43. TS_ROUTES: {{ join "," . }}
  44. {{ end }}
  45. {{ with (include "tailscale.args" $) }}
  46. TS_EXTRA_ARGS: {{ . }}
  47. {{ end }}
  48. {{ with .Values.tailscaleConfig.extraDaemonArgs }}
  49. TS_TAILSCALED_ARGS: {{ join " " . }}
  50. {{ end }}
  51. {{ with .Values.tailscaleConfig.additionalEnvs }}
  52. envList:
  53. {{ range $env := . }}
  54. - name: {{ $env.name }}
  55. value: {{ $env.value }}
  56. {{ end }}
  57. {{ end }}
  58. probes:
  59. liveness:
  60. enabled: true
  61. type: exec
  62. command:
  63. - tailscale
  64. - status
  65. readiness:
  66. enabled: true
  67. type: exec
  68. command:
  69. - tailscale
  70. - status
  71. startup:
  72. enabled: true
  73. type: exec
  74. command:
  75. - tailscale
  76. - status
  77. {{/* RBAC */}}
  78. serviceAccount:
  79. tailscale:
  80. enabled: true
  81. primary: true
  82. rbac:
  83. tailscale:
  84. enabled: true
  85. primary: true
  86. rules:
  87. - apiGroups:
  88. - ""
  89. resources:
  90. - secrets
  91. verbs:
  92. - create
  93. - apiGroups:
  94. - ""
  95. resources:
  96. - secrets
  97. resourceNames:
  98. - {{ printf "%s-tailscale-secret" (include "ix.v1.common.lib.chart.names.fullname" .) }}
  99. verbs:
  100. - get
  101. - update
  102. - patch
  103. {{/* Persistence */}}
  104. persistence:
  105. tun-dev:
  106. enabled: {{ not .Values.tailscaleConfig.userspace }}
  107. type: device
  108. hostPath: /dev/net/tun
  109. targetSelector:
  110. tailscale:
  111. tailscale:
  112. mountPath: /dev/net/tun
  113. var-run:
  114. enabled: true
  115. type: emptyDir
  116. targetSelector:
  117. tailscale:
  118. tailscale:
  119. mountPath: /var/run
  120. cache:
  121. enabled: true
  122. type: emptyDir
  123. targetSelector:
  124. tailscale:
  125. tailscale:
  126. mountPath: /.cache
  127. {{/* Secret */}}
  128. secret:
  129. tailscale-secret:
  130. enabled: true
  131. data:
  132. {{/* Name "authkey" must not be changed, it's what tailscale looks for */}}
  133. authkey: {{ .Values.tailscaleConfig.authkey }}
  134. {{- end -}}