_tailscale.tpl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. {{ with .Values.tailscaleConfig.advertiseRoutes }}
  42. TS_ROUTES: {{ join "," . }}
  43. {{ end }}
  44. {{ with (include "tailscale.args" $) }}
  45. TS_EXTRA_ARGS: {{ . }}
  46. {{ end }}
  47. {{ with .Values.tailscaleConfig.extraDaemonArgs }}
  48. TS_TAILSCALED_ARGS: {{ join " " . }}
  49. {{ end }}
  50. {{ with .Values.tailscaleConfig.additionalEnvs }}
  51. envList:
  52. {{ range $env := . }}
  53. - name: {{ $env.name }}
  54. value: {{ $env.value }}
  55. {{ end }}
  56. {{ end }}
  57. probes:
  58. liveness:
  59. enabled: true
  60. type: exec
  61. command:
  62. - tailscale
  63. - status
  64. readiness:
  65. enabled: true
  66. type: exec
  67. command:
  68. - tailscale
  69. - status
  70. startup:
  71. enabled: true
  72. type: exec
  73. command:
  74. - tailscale
  75. - status
  76. {{/* RBAC */}}
  77. serviceAccount:
  78. tailscale:
  79. enabled: true
  80. primary: true
  81. rbac:
  82. tailscale:
  83. enabled: true
  84. primary: true
  85. rules:
  86. - apiGroups:
  87. - ""
  88. resources:
  89. - secrets
  90. verbs:
  91. - create
  92. - apiGroups:
  93. - ""
  94. resources:
  95. - secrets
  96. resourceNames:
  97. - {{ printf "%s-tailscale-secret" (include "ix.v1.common.lib.chart.names.fullname" .) }}
  98. verbs:
  99. - get
  100. - update
  101. - patch
  102. {{/* Persistence */}}
  103. persistence:
  104. tun-dev:
  105. enabled: {{ not .Values.tailscaleConfig.userspace }}
  106. type: device
  107. hostPath: /dev/net/tun
  108. targetSelector:
  109. tailscale:
  110. tailscale:
  111. mountPath: /dev/net/tun
  112. var-run:
  113. enabled: true
  114. type: emptyDir
  115. targetSelector:
  116. tailscale:
  117. tailscale:
  118. mountPath: /var/run
  119. cache:
  120. enabled: true
  121. type: emptyDir
  122. targetSelector:
  123. tailscale:
  124. tailscale:
  125. mountPath: /.cache
  126. {{/* Secret */}}
  127. secret:
  128. tailscale-secret:
  129. enabled: true
  130. data:
  131. {{/* Name "authkey" must not be changed, it's what tailscale looks for */}}
  132. authkey: {{ .Values.tailscaleConfig.authkey }}
  133. {{- end -}}