From 7d2d308aad2b9680525a845b503ce454ebf71bd4 Mon Sep 17 00:00:00 2001 From: kriegalex Date: Tue, 6 Aug 2024 19:40:44 +0000 Subject: [PATCH] refactor env variables --- charts/qbittorrent-gluetun/Chart.yaml | 2 +- .../templates/deployment.yaml | 38 ++++++++++++++----- charts/qbittorrent-gluetun/values.yaml | 25 ++++++++++-- 3 files changed, 51 insertions(+), 14 deletions(-) diff --git a/charts/qbittorrent-gluetun/Chart.yaml b/charts/qbittorrent-gluetun/Chart.yaml index e257030..b57e3a0 100644 --- a/charts/qbittorrent-gluetun/Chart.yaml +++ b/charts/qbittorrent-gluetun/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "4.6.5" # this is not updated automatically description: A Helm chart for qBittorrent with Gluetun VPN name: qbittorrent-gluetun -version: 0.3.0 +version: 0.3.1 keywords: - qbittorrent - torrrent diff --git a/charts/qbittorrent-gluetun/templates/deployment.yaml b/charts/qbittorrent-gluetun/templates/deployment.yaml index 7ddf0fb..8625b98 100644 --- a/charts/qbittorrent-gluetun/templates/deployment.yaml +++ b/charts/qbittorrent-gluetun/templates/deployment.yaml @@ -27,25 +27,45 @@ spec: value: {{ .Values.gluetun.env.SERVER_REGIONS | quote }} - name: VPN_PORT_FORWARDING value: {{ .Values.gluetun.env.VPN_PORT_FORWARDING | quote }} + - name: PORT_FORWARD_ONLY + value: {{ .Values.gluetun.env.PORT_FORWARD_ONLY | quote }} + - name: PUBLICIP_API + value: {{ .Values.gluetun.env.PUBLICIP_API | quote }} + {{- if .Values.gluetun.env.PUBLICIP_API_TOKEN }} + - name: PUBLICIP_API_TOKEN + value: {{ .Values.gluetun.env.PUBLICIP_API_TOKEN | quote }} + {{- end }} + {{- if .Values.gluetun.env.OPENVPN_USER }} + - name: OPENVPN_USER + value: {{ .Values.gluetun.env.OPENVPN_USER | quote }} + {{- end }} + {{- if .Values.gluetun.env.OPENVPN_PASSWORD }} + - name: OPENVPN_PASSWORD + value: {{ .Values.gluetun.env.OPENVPN_PASSWORD | quote }} + {{- end }} + {{- if .Values.gluetun.secret.existingSecret }} + {{- if .Values.gluetun.secret.existingKeys.openvpnUser }} - name: OPENVPN_USER valueFrom: secretKeyRef: - name: {{ .Values.gluetun.secret.name }} - key: OPENVPN_USER + name: {{ .Values.gluetun.secret.existingSecret }} + key: {{ .Values.gluetun.secret.existingKeys.openvpnUser }} + {{- end }} + {{- if .Values.gluetun.secret.existingKeys.openvpnPassword }} - name: OPENVPN_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.gluetun.secret.name }} - key: OPENVPN_PASSWORD - {{- if .Values.gluetun.env.PUBLICIP_API }} - - name: PUBLICIP_API - value: {{ .Values.gluetun.env.PUBLICIP_API | quote }} + name: {{ .Values.gluetun.secret.existingSecret }} + key: {{ .Values.gluetun.secret.existingKeys.openvpnPassword }} + {{- end }} + {{- if .Values.gluetun.secret.existingKeys.publicIpApiToken }} - name: PUBLICIP_API_TOKEN valueFrom: secretKeyRef: - name: {{ .Values.gluetun.secret.name }} - key: PUBLICIP_API_TOKEN + name: {{ .Values.gluetun.secret.existingSecret }} + key: {{ .Values.gluetun.secret.existingKeys.publicIpApiToken }} {{- end }} + {{- end }} # existingSecret securityContext: capabilities: add: ["NET_ADMIN"] diff --git a/charts/qbittorrent-gluetun/values.yaml b/charts/qbittorrent-gluetun/values.yaml index 821fd02..fa62246 100644 --- a/charts/qbittorrent-gluetun/values.yaml +++ b/charts/qbittorrent-gluetun/values.yaml @@ -17,11 +17,28 @@ gluetun: controlServerPort: 8000 env: - VPN_SERVICE_PROVIDER: "private internet access" - SERVER_REGIONS: "Switzerland" - VPN_PORT_FORWARDING: true + OPENVPN_USER: "" + OPENVPN_PASSWORD: "" + # Specify a supported VPN provider to use + VPN_SERVICE_PROVIDER: "" + # Comma separated list of regions + SERVER_REGIONS: "" + # Enable custom port forwarding code for supported providers + VPN_PORT_FORWARDING: off + # For private internet access, set to true to select servers with port forwarding only + PORT_FORWARD_ONLY: false + # Public IP echo service API to use + PUBLICIP_API: ipinfo + # Optional API token for the public IP echo service to increase rate limiting + PUBLICIP_API_TOKEN: "" secret: - name: vpn-credentials + # Name of existing secret to use for OpenVPN and IP API credentials. + existingSecret: "" + # Names of keys in existing secret to use for credentials + existingKeys: + openvpnUser: "" + openvpnPassword: "" + publicIpApiToken: "" # Persistence persistence: