From c5760a58646cb8c5c81d27c9988339e4ee0bafb3 Mon Sep 17 00:00:00 2001 From: kqmaverick <121722567+kqmaverick@users.noreply.github.com> Date: Sun, 19 Nov 2023 10:39:34 -0800 Subject: [PATCH] feat(qbittorrent): add port forward sidecar (#14577) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Adds an automatic port forward sidecar script. ⚒️ Fixes # **⚙️ Type of change** - [X] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Signed-off-by: kqmaverick <121722567+kqmaverick@users.noreply.github.com> Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/stable/qbittorrent/Chart.yaml | 2 +- charts/stable/qbittorrent/questions.yaml | 28 ++++++++++ .../stable/qbittorrent/templates/common.yaml | 11 ++-- charts/stable/qbittorrent/values.yaml | 51 +++++++++++++++---- 4 files changed, 74 insertions(+), 18 deletions(-) diff --git a/charts/stable/qbittorrent/Chart.yaml b/charts/stable/qbittorrent/Chart.yaml index ecb727a03b4..ef79df44738 100644 --- a/charts/stable/qbittorrent/Chart.yaml +++ b/charts/stable/qbittorrent/Chart.yaml @@ -21,7 +21,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/qbittorrent - https://github.com/qbittorrent/qBittorrent type: application -version: 16.0.12 +version: 16.1.0 annotations: truecharts.org/category: media truecharts.org/SCALE-support: "true" diff --git a/charts/stable/qbittorrent/questions.yaml b/charts/stable/qbittorrent/questions.yaml index f2685bd0a72..dc8cea846e5 100644 --- a/charts/stable/qbittorrent/questions.yaml +++ b/charts/stable/qbittorrent/questions.yaml @@ -16,6 +16,34 @@ questions: # Include{containerAdvanced} # Include{containerConfig} + - variable: qbitportforward + group: App Configuration + label: Gluetun Port Forwarding + schema: + additional_attrs: true + type: dict + attrs: + - variable: enabled + label: Enable Gluetun Port Forwarding Automation + description: Enable and configure Gluetun Port Forwarding Automation. + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: QBT_USERNAME + label: qBittorrent Username + description: qBittorrent WebUI Username + schema: + type: string + default: "admin" + - variable: QBT_PASSWORD + label: qBittorrent Password + description: qBittorrent WebUI Password + schema: + type: string + default: "adminadmin" + # Include{podOptions} # Include{serviceRoot} # Include{serviceMain} diff --git a/charts/stable/qbittorrent/templates/common.yaml b/charts/stable/qbittorrent/templates/common.yaml index 6f4a8126984..72b5bf40828 100644 --- a/charts/stable/qbittorrent/templates/common.yaml +++ b/charts/stable/qbittorrent/templates/common.yaml @@ -1,13 +1,10 @@ {{/* Make sure all variables are set properly */}} {{- include "tc.v1.common.loader.init" . }} -{{/* Set it to the same port as "torrent" service/port */}} -{{- $_ := set $.Values.service.torrent.ports.torrentudp "port" .Values.service.torrent.ports.torrent.port -}} - -{{/* Render configmap for vaultwarden */}} -{{- $configmap := include "qbittorrent.configmap" . | fromYaml -}} -{{- if $configmap -}} -{{- $_ := set .Values.configmap "qbittorrent-scripts" $configmap -}} +{{/* Disable [qbitportforward] if requested */}} +{{- if not .Values.qbitportforward.enabled -}} + {{- $_ := set .Values.workload.qbitportforward "enabled" false -}} + {{- $_ := set .Values.service.gluetun "enabled" false -}} {{- end -}} {{/* Render the templates */}} diff --git a/charts/stable/qbittorrent/values.yaml b/charts/stable/qbittorrent/values.yaml index 3d1eb5b6973..749f8d0122e 100644 --- a/charts/stable/qbittorrent/values.yaml +++ b/charts/stable/qbittorrent/values.yaml @@ -2,6 +2,14 @@ image: repository: ghcr.io/onedr0p/qbittorrent pullPolicy: IfNotPresent tag: 4.6.0@sha256:cb6259df3be61a5108bc4f85b09a523fc4b250589ca9b315ef927cbdf779afb6 +qbitportforwardImage: + repository: mjmeli/qbittorrent-port-forward-gluetun-server + pullPolicy: IfNotPresent + tag: latest@sha256:67d0d21ed792cf80716d4211e7162b6d375af5c12f3cf096c9032ad705dddaa8 +qbitportforward: + enabled: false + QBT_USERNAME: "admin" + QBT_PASSWORD: "adminadmin" service: main: ports: @@ -19,20 +27,43 @@ service: enabled: true port: 6881 protocol: udp + gluetun: + enabled: true + type: ClusterIP + ports: + gluetun: + enabled: true + port: 8000 + targetPort: 8000 + protocol: http +workload: + qbitportforward: + enabled: true + type: Deployment + strategy: RollingUpdate + replicas: 1 + podSpec: + containers: + qbitportforward: + primary: true + enabled: true + imageSelector: qbitportforwardImage + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + env: + QBT_USERNAME: "{{ .Values.qbitportforward.QBT_USERNAME }}" + QBT_PASSWORD: "{{ .Values.qbitportforward.QBT_PASSWORD }}" + QBT_ADDR: '{{ printf "http://%v:%v" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.main.ports.main.port }}' + GTN_ADDR: '{{ printf "http://%v-gluetun:8000" (include "tc.v1.common.lib.chart.names.fullname" $) }}' persistence: config: enabled: true mountPath: "/config" -additionalVolumes: - - name: qbittorrent-scripts - emptyDir: {} - ## When you want to enable automatic port configuration at startup, adjust this to: - # configMap: - # name: -scripts - # defaultMode: "511" -additionalVolumeMounts: - - mountPath: "/config/custom-cont-init.d" - name: qbittorrent-scripts portal: open: enabled: true