daemonset.yaml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {{- if and .Values.netOpenvpn .Values.router -}}
  2. kind: DaemonSet
  3. apiVersion: apps/v1
  4. metadata:
  5. name: {{ include "openvpn.fullname" . }}-router
  6. labels:
  7. {{- include "openvpn.router.labels" . | nindent 4 }}
  8. spec:
  9. selector:
  10. matchLabels:
  11. {{- include "openvpn.router.selectorLabels" . | nindent 6 }}
  12. template:
  13. metadata:
  14. labels:
  15. {{- include "openvpn.router.selectorLabels" . | nindent 8 }}
  16. annotations:
  17. checksum/config: {{ include (print $.Template.BasePath "/cm-router.yaml") . | sha256sum }}
  18. spec:
  19. serviceAccountName: {{ .Release.Name }}-router
  20. {{- if .Values.registry_secret_data }}
  21. imagePullSecrets:
  22. - name: {{ include "openvpn.fullname" . }}-registry-secret
  23. {{- end }}
  24. hostNetwork: true
  25. priorityClassName: system-cluster-critical
  26. containers:
  27. - name: {{ .Chart.Name }}-router
  28. image: "{{ .Values.router.image }}:{{ .Values.router.tag }}"
  29. imagePullPolicy: IfNotPresent
  30. command: ["/bin/sh"]
  31. args: ["-c","/opt/route-add"]
  32. lifecycle:
  33. preStop:
  34. exec:
  35. command: ["/bin/sh","-c","/opt/route-delete"]
  36. securityContext:
  37. capabilities:
  38. add:
  39. - NET_ADMIN
  40. resources:
  41. {{- toYaml .Values.router.resources | nindent 12 }}
  42. volumeMounts:
  43. - name: routecheck
  44. mountPath: /opt
  45. volumes:
  46. - name: routecheck
  47. configMap:
  48. name: {{ include "openvpn.fullname" . }}-routecheck
  49. defaultMode: 0755
  50. {{- end -}}