From 571372c4c787ba0004d237c7a21560e439701d15 Mon Sep 17 00:00:00 2001 From: bjws Date: Thu, 24 Sep 2020 13:08:29 +0200 Subject: [PATCH] [qbittorrent] No longer require additionalports --- charts/qbittorrent/templates/configmap.yaml | 4 +-- charts/qbittorrent/templates/service.yaml | 28 +++++++++++++++++++++ charts/qbittorrent/values.yaml | 28 +++++++++++++++------ 3 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 charts/qbittorrent/templates/service.yaml diff --git a/charts/qbittorrent/templates/configmap.yaml b/charts/qbittorrent/templates/configmap.yaml index 16942f08..69f469e5 100644 --- a/charts/qbittorrent/templates/configmap.yaml +++ b/charts/qbittorrent/templates/configmap.yaml @@ -5,11 +5,11 @@ metadata: labels: {{- include "media-common.labels" . | nindent 4 }} data: - {{- if .Values.qbittorrent.service.additionalPorts.bittorrent }} + {{- if and .Values.qbittorrent.btService .Values.qbittorrent.btService.port }} 31-update-port: |- #!/bin/bash QBITTORRENT_CONFIGFILE="/config/qBittorrent/qBittorrent.conf" - INCOMING_PORT={{- .Values.qbittorrent.service.additionalPorts.bittorrent.port }} + INCOMING_PORT={{- .Values.qbittorrent.btService.port }} incoming_port_exist=$(cat ${QBITTORRENT_CONFIGFILE} | grep -m 1 'Connection\\PortRangeMin='${INCOMING_PORT}) if [[ -z "${incoming_port_exist}" ]]; then diff --git a/charts/qbittorrent/templates/service.yaml b/charts/qbittorrent/templates/service.yaml new file mode 100644 index 00000000..c8b9766d --- /dev/null +++ b/charts/qbittorrent/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "media-common.fullname" . }}-bittorrent + labels: + {{- include "media-common.labels" . | nindent 4 }} + {{- if .Values.qbittorrent.btService.labels }} + {{ toYaml .Values.qbittorrent.btService.labels | indent 4 }} + {{- end }} + {{- with .Values.qbittorrent.btService.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.qbittorrent.btService.type }} + ports: + - name: bittorrent + port: {{ .Values.qbittorrent.btService.port }} + protocol: TCP + targetPort: {{ .Values.qbittorrent.btService.port }} + {{- if (and (eq .Values.qbittorrent.btService.type "NodePort") (not (empty .Values.qbittorrent.btService.nodePort))) }} + nodePort: {{ .Values.qbittorrent.btService.nodePort }} + {{- end }} + {{- with .Values.qbittorrent.btService.additionalSpec }} + {{- toYaml . | nindent 2 }} + {{- end }} + selector: + {{- include "media-common.selectorLabels" . | nindent 4 }} diff --git a/charts/qbittorrent/values.yaml b/charts/qbittorrent/values.yaml index f7e5dda7..f46dc39d 100644 --- a/charts/qbittorrent/values.yaml +++ b/charts/qbittorrent/values.yaml @@ -7,17 +7,29 @@ qbittorrent: pullPolicy: IfNotPresent tag: 14.2.5.99202004250119-7015-2c65b79ubuntu18.04.1-ls91 - env: {} - # TZ: UTC - # PUID: 1001 - # PGID: 1001 - # UMASK: 022 + env: + TZ: UTC + PUID: 1001 + PGID: 1001 + UMASK: 022 service: port: 8080 - additionalPorts: - bittorrent: - port: 6881 + + btService: + type: ClusterIP + port: 6881 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + labels: {} + additionalSpec: {} persistence: downloads: