diff --git a/k8s/apps/authelia/values.yaml b/k8s/apps/authelia/values.yaml index 63c548b..143d28d 100644 --- a/k8s/apps/authelia/values.yaml +++ b/k8s/apps/authelia/values.yaml @@ -27,7 +27,7 @@ authelia: revisionHistoryLimit: 1 env: - name: TZ - value: America/Toronto + value: "America/Toronto" resources: limits: diff --git a/k8s/apps/videohosting/templates/_helpers/openvpn-container.yaml b/k8s/apps/videohosting/templates/_helpers/openvpn-container.yaml new file mode 100644 index 0000000..ee6603d --- /dev/null +++ b/k8s/apps/videohosting/templates/_helpers/openvpn-container.yaml @@ -0,0 +1,94 @@ +{{ define "homelab.nordvpn "}} +- name: vpn + image: ghcr.io/bubuntux/nordvpn + stdin: true + tty: true + securityContext: + privileged: true + capabilities: + add: + - NET_ADMIN + - NET_RAW + env: + - name: TZ + value: "{{ .Values.global.timezone }}" + volumeMounts: + - name: vpn-config + mountPath: /vpn/client.ovpn + subPath: client.ovpn + - name: vpn-config + mountPath: /vpn/auth.txt + subPath: auth.txt + - name: vpn-tmp + mountPath: /tmp/route + image: ghcr.io/bubuntux/nordvpn + env: + - name: TOKEN + valueFrom: + secretKeyRef: + name: openvpn-creds + key: nordvpn_token + - name: CONNECT + value: Canada + - name: TECHNOLOGY + value: NordLynx + # - name: NETWORK + # value: NordLynx +{{ end }} + +{{ define "homelab.openvpn.container" }} +- name: vpn + image: dperson/openvpn-client + command: ["/bin/sh","-c"] + args: ["openvpn --config 'vpn/client.ovpn' --auth-user-pass 'vpn/auth.txt' --script-security 3 --route-up /tmp/route/route-override.sh;"] + stdin: true + tty: true + securityContext: + privileged: true + capabilities: + add: + - NET_ADMIN + env: + - name: TZ + value: "{{ .Values.global.timezone }}" + volumeMounts: + - name: vpn-config + mountPath: /vpn/client.ovpn + subPath: client.ovpn + - name: vpn-config + mountPath: /vpn/auth.txt + subPath: auth.txt + - name: vpn-tmp + mountPath: /tmp/route +{{ end }} + +{{ define "homelab.openvpn.initContainer" }} +- name: vpn-route-init + image: busybox + command: ['/bin/sh', '-c', 'cp /vpn/route-override.sh /tmp/route/route-override.sh; chown root:root /tmp/route/route-override.sh; chmod o+x /tmp/route/route-override.sh;'] + volumeMounts: + - name: vpn-tmp + mountPath: /tmp/route + - name: route-script + mountPath: /vpn/route-override.sh + subPath: route-override.sh +{{ end }} + +{{ define "homelab.openvpn.volumes" }} +- name: vpn-config + secret: + secretName: openvpn-creds + items: + - key: client.ovpn + path: client.ovpn + - key: auth.txt + path: auth.txt +- name: route-script + configMap: + name: openvpn-route-script + items: + - key: route-override.sh + path: route-override.sh +- name: vpn-tmp + emptyDir: {} +{{ end }} \ No newline at end of file diff --git a/k8s/apps/videohosting/templates/configs-openvpn.yaml b/k8s/apps/videohosting/templates/configs-openvpn.yaml new file mode 100644 index 0000000..ab99d41 --- /dev/null +++ b/k8s/apps/videohosting/templates/configs-openvpn.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: openvpn-creds +type: Opaque +data: + _placeholder: "" + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: openvpn-route-script +data: + route-override.sh: |- + #!/bin/sh + VPN_GATEWAY=$(route -n | awk 'NR==3' | awk '{ print $2 }') + ip route del 0.0.0.0/1 via $VPN_GATEWAY + echo "Route Updated" \ No newline at end of file