fix(qbittorrent) fix qbittorrent set the ports automatically and remove deprecated code. (#19205)

**Description**
Set the ports automatically when defined and remove deprecated code.
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [X] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [X] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 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
- [X] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ 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._
This commit is contained in:
Xstar97TheNoob
2024-03-16 06:24:05 -04:00
committed by GitHub
parent cc36fe31ee
commit 68b93f409a
3 changed files with 19 additions and 30 deletions

View File

@@ -35,4 +35,4 @@ sources:
- https://ghcr.io/onedr0p/qbittorrent
- https://hub.docker.com/r/mjmeli/qbittorrent-port-forward-gluetun-server
type: application
version: 19.5.2
version: 19.5.3

View File

@@ -1,25 +0,0 @@
{{/* Define the configmap */}}
{{- define "qbittorrent.configmap" -}}
data:
{{- $bittorrentPort := "" -}}
{{- $bittorrentPort = .Values.service.torrent.ports.torrent.port -}}
{{- if $bittorrentPort }}
31-update-port: |-
#!/bin/bash
QBITTORRENT_CONFIGFILE="/config/qBittorrent/qBittorrent.conf"
INCOMING_PORT={{- $bittorrentPort }}
incoming_port_exist=$(cat ${QBITTORRENT_CONFIGFILE} | grep -m 1 'Connection\\PortRangeMin='${INCOMING_PORT})
if [[ -z "${incoming_port_exist}" ]]; then
incoming_exist=$(cat ${QBITTORRENT_CONFIGFILE} | grep -m 1 'Connection\\PortRangeMin')
if [[ ! -z "${incoming_exist}" ]]; then
# Get line number of Incoming
LINE_NUM=$(grep -Fn -m 1 'Connection\PortRangeMin' ${QBITTORRENT_CONFIGFILE} | cut -d: -f 1)
sed -i "${LINE_NUM}s@.*@Connection\\\PortRangeMin=${INCOMING_PORT}@" ${QBITTORRENT_CONFIGFILE}
else
echo "Connection\\PortRangeMin=${INCOMING_PORT}" >> ${QBITTORRENT_CONFIGFILE}
fi
fi
{{- end }}
{{- end -}}

View File

@@ -6,6 +6,10 @@ qbitportforwardImage:
repository: mjmeli/qbittorrent-port-forward-gluetun-server
pullPolicy: IfNotPresent
tag: latest@sha256:67d0d21ed792cf80716d4211e7162b6d375af5c12f3cf096c9032ad705dddaa8
securityContext:
container:
readOnlyRootFilesystem: false
qbitportforward:
enabled: false
QBT_USERNAME: "admin"
@@ -15,7 +19,6 @@ service:
ports:
main:
port: 10095
targetPort: 8080
torrent:
enabled: true
ports:
@@ -37,6 +40,20 @@ service:
targetPort: 8000
protocol: http
workload:
main:
podSpec:
containers:
main:
env:
# set the default port
QBITTORRENT__PORT: "{{ .Values.service.main.ports.main.port }}"
# stops users from bricking their chart from setting the ip to a random ip when its a container.
QBT_Preferences__WebUI__Address: "0.0.0.0"
# set port from gui.
QBT_BitTorrent__Session__Port: "{{ .Values.service.torrent.ports.torrent.port }}"
# legacy ini key
# key deprecated https://github.com/qbittorrent/qBittorrent/issues/8324
QBT_Preferences__Connection__PortRangeMin: "{{ .Values.service.torrent.ports.torrent.port }}"
qbitportforward:
enabled: true
type: CronJob
@@ -68,6 +85,3 @@ persistence:
portal:
open:
enabled: true
securityContext:
container:
readOnlyRootFilesystem: false