cm-openvpnscripts.yaml 965 B

12345678910111213141516171819202122232425262728
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: {{ include "openvpn.fullname" . }}-scripts
  5. data:
  6. # Main openvpn container startup script, aka ENTRYPOINT
  7. {{- if .Values.openvpn.startscript }}
  8. startscript: {{- toYaml .Values.openvpn.startscript | indent 2 }}
  9. {{- else }}
  10. startscript: |-
  11. #!/bin/bash
  12. {{- if and .Values.virtIP_addr .Values.virtIP_dev }}
  13. ip addr add {{ .Values.virtIP_addr }} dev {{ .Values.virtIP_dev }}
  14. {{- end }}
  15. mkdir /dev/net
  16. mknod /dev/net/tun c 10 200
  17. exec "/usr/sbin/openvpn" "--config" "/etc/openvpn/configuration/openvpn.conf"
  18. {{- end }}
  19. {{- if and .Values.virtIP_addr .Values.virtIP_dev }}
  20. # Stop script, executed by separate container on Pod termination.
  21. stopscript: |-
  22. #!/bin/bash
  23. ip addr delete {{ .Values.virtIP_addr }} dev {{ .Values.virtIP_dev }}
  24. {{- end }}
  25. {{- if .Values.openvpn.healthcheck }}
  26. healthcheck: {{- toYaml .Values.openvpn.healthcheck | indent 2 }}
  27. {{- end }}