apiVersion: v1 kind: ConfigMap metadata: name: {{ include "openvpn.fullname" . }}-scripts data: # Main openvpn container startup script, aka ENTRYPOINT {{- if .Values.openvpn.startscript }} startscript: {{- toYaml .Values.openvpn.startscript | indent 2 }} {{- else }} startscript: |- #!/bin/bash {{- if and .Values.virtIP_addr .Values.virtIP_dev }} ip addr add {{ .Values.virtIP_addr }} dev {{ .Values.virtIP_dev }} {{- end }} mkdir /dev/net mknod /dev/net/tun c 10 200 exec "/usr/sbin/openvpn" "--config" "/etc/openvpn/configuration/openvpn.conf" {{- end }} {{- if and .Values.virtIP_addr .Values.virtIP_dev }} # Stop script, executed by separate container on Pod termination. stopscript: |- #!/bin/bash ip addr delete {{ .Values.virtIP_addr }} dev {{ .Values.virtIP_dev }} {{- end }} {{- if .Values.openvpn.healthcheck }} healthcheck: {{- toYaml .Values.openvpn.healthcheck | indent 2 }} {{- end }}