apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: vpnclient-test
  labels:
    app: vpnclient-test
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: vpnclient-test
  template:
    metadata:
      labels:
        app: vpnclient-test
    spec:
      containers:
      - name: vpnclient-test
        image: angelnu/openvpn-helper
        imagePullPolicy: Always
        securityContext:
          capabilities:
            add:
              - NET_ADMIN
        command:
        - "/bin/sh"
        - "-ec"
        - |
          while [ 1 ]; do sleep 2;done
        livenessProbe:
          exec:
            command:
            - ping
            - -c3
            - -w15
            - casa96.angelnu.com
          initialDelaySeconds: 60
          periodSeconds: 300
        volumeMounts:
# VPN boiler-plate 1 (insert at the end of volumeMounts)
        - name: resolv
          mountPath: /etc/resolv.conf
          subPath: resolv.conf
      - name: vxlan
        image: angelnu/openvpn-helper
        imagePullPolicy: Always
        securityContext:
          capabilities:
            add:
              - NET_ADMIN
        volumeMounts:
        - name: resolv
          mountPath: /etc_shared
# end of VPN boiler-plate 1
      volumes:
# VPN boiler-plate 2 (append at the end of the volumes section)
      - name: resolv
        emptyDir: {}
      initContainers:
      - name: init-vxlan
        image: angelnu/openvpn-helper
        imagePullPolicy: Always
        securityContext:
          capabilities:
            add:
              - NET_ADMIN
        env:
        - name: FIRST_BOOT
          value: "true"
        volumeMounts:
        - name: resolv
          mountPath: /etc_shared
# end of VPN boiler-plate 2
