diff --git a/charts/qbittorrent/Chart.yaml b/charts/qbittorrent/Chart.yaml index 0fbfd1c1..1d8f53ec 100644 --- a/charts/qbittorrent/Chart.yaml +++ b/charts/qbittorrent/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 4.2.5 description: qBittorrent is a cross-platform free and open-source BitTorrent client name: qbittorrent -version: 4.0.1 +version: 5.0.0 keywords: - qbittorrent - torrrent @@ -13,3 +13,8 @@ sources: maintainers: - name: billimek email: jeff@billimek.com +dependencies: + - name: media-common + repository: https://k8s-at-home.com/charts/ + version: ^1.0.0 + alias: qbittorrent diff --git a/charts/qbittorrent/README.md b/charts/qbittorrent/README.md index cfd6f8eb..56adef63 100644 --- a/charts/qbittorrent/README.md +++ b/charts/qbittorrent/README.md @@ -20,7 +20,7 @@ helm install --name my-release k8s-at-home/qbittorrent The default login details (change ASAP) are: * login:admin -* password:admin +* password:adminadmin ## Uninstalling the Chart @@ -33,82 +33,35 @@ helm delete my-release --purge The command removes all the Kubernetes components associated with the chart and deletes the release. ## Configuration - -The following tables lists the configurable parameters of the Sentry chart and their default values. - -| Parameter | Description | Default | -|----------------------------|-------------------------------------|---------------------------------------------------------| -| `image.repository` | Image repository | `linuxserver/qbittorrent` | -| `image.tag` | Image tag. Possible values listed [here](https://hub.docker.com/r/linuxserver/qbittorrent/tags/).| `14.2.0.99201912180418-6819-118af03ubuntu18.04.1-ls57`| -| `image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `strategyType` | Specifies the strategy used to replace old Pods by new ones | `Recreate` | -| `timezone` | Timezone the qbittorrent instance should run as, e.g. 'America/New_York' | `UTC` | -| `puid` | process userID the qbittorrent instance should run as | `1001` | -| `pgid` | process groupID the qbittorrent instance should run as | `1001` | -| `umask` | newly created files should be set to this umask value | `022` | -| `probes.liveness.initialDelaySeconds` | Specify liveness `initialDelaySeconds` parameter for the deployment | `60` | -| `probes.liveness.failureThreshold` | Specify liveness `failureThreshold` parameter for the deployment | `5` | -| `probes.liveness.timeoutSeconds` | Specify liveness `timeoutSeconds` parameter for the deployment | `10` | -| `probes.readiness.initialDelaySeconds` | Specify readiness `initialDelaySeconds` parameter for the deployment | `60` | -| `probes.readiness.failureThreshold` | Specify readiness `failureThreshold` parameter for the deployment | `5` | -| `probes.readiness.timeoutSeconds` | Specify readiness `timeoutSeconds` parameter for the deployment | `10` | -| `guiService.type` | Kubernetes service type for the qbittorrent GUI | `ClusterIP` | -| `guiService.port` | Kubernetes port where the qbittorrent GUI is exposed| `8080` | -| `guiService.annotations` | Service annotations for the qbittorrent GUI | `{}` | -| `guiService.labels` | Custom labels | `{}` | -| `guiService.loadBalancerIP` | Loadbalance IP for the qbittorrent GUI | `{}` | -| `btService.type` | Kubernetes service type for the qbittorrent listening bittorrent port | `NodePort` | -| `btService.port` | Kubernetes port where the qbittorrent listening bittorrent port | `6881` | -| `btService.annotations` | Service annotations for the qbittorrent bittorrent protocol | `{}` | -| `btService.labels` | Custom labels | `{}` | -| `btService.loadBalancerIP` | Loadbalance IP for the qbittorrent bittorrent protocol | `{}` | -| `ingress.enabled` | Enables Ingress | `false` | -| `ingress.annotations` | Ingress annotations | `{}` | -| `ingress.labels` | Custom labels | `{}` -| `ingress.path` | Ingress path | `/` | -| `ingress.hosts` | Ingress accepted hostnames | `chart-example.local` | -| `ingress.tls` | Ingress TLS configuration | `[]` | -| `persistence.config.enabled` | Use persistent volume to store configuration data | `true` | -| `persistence.config.size` | Size of persistent volume claim | `1Gi` | -| `persistence.config.existingClaim`| Use an existing PVC to persist data | `nil` | -| `persistence.config.subPath` | Mount a sub directory of the persistent volume if set | `""` | -| `persistence.config.storageClass` | Type of persistent volume claim | `-` | -| `persistence.config.accessMode` | Persistence access mode | `ReadWriteOnce` | -| `persistence.config.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | -| `persistence.downloads.enabled` | Use persistent volume to store configuration data | `true` | -| `persistence.downloads.size` | Size of persistent volume claim | `10Gi` | -| `persistence.downloads.existingClaim`| Use an existing PVC to persist data | `nil` | -| `persistence.downloads.subPath` | Mount a sub directory of the persistent volume if set | `""` | -| `persistence.downloads.storageClass` | Type of persistent volume claim | `-` | -| `persistence.downloads.accessMode` | Persistence access mode | `ReadWriteOnce` | -| `persistence.downloads.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | -| `persistence.extraMounts` | Array of additional claims to mount | `[]` | -| `resources` | CPU/Memory resource requests/limits | `{}` | -| `nodeSelector` | Node labels for pod assignment | `{}` | -| `tolerations` | Toleration labels for pod assignment | `[]` | -| `affinity` | Affinity settings for pod assignment | `{}` | -| `podAnnotations` | Key-value pairs to add as pod annotations | `{}` | -| `deploymentAnnotations` | Key-value pairs to add as deployment annotations | `{}` | +Read through the media-common [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/media-common/values.yaml) +file. It has several commented out suggested values. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, - ```console -helm install --name my-release \ - --set timezone="America/New York" \ +helm install qbittorrent \ + --set qbittorrent.env.TZ="America/New York" \ k8s-at-home/qbittorrent ``` - -Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, - +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the +chart. For example, ```console -helm install --name my-release -f values.yaml k8s-at-home/qbittorrent +helm install qbittorrent k8s-at-home/qbittorrent --values values.yaml +``` + +These values will be nested as it is a dependency, for example +```yaml +qbittorrent: + image: + tag: ... ``` --- **NOTE** -If you get `Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...` it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`. +If you get +```console +Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...` +``` +it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`. --- - -Read through the [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/qbittorrent/values.yaml) file. It has several commented out suggested values. diff --git a/charts/qbittorrent/ci/ct-values.yaml b/charts/qbittorrent/ci/ct-values.yaml new file mode 100644 index 00000000..5d91d64a --- /dev/null +++ b/charts/qbittorrent/ci/ct-values.yaml @@ -0,0 +1,12 @@ +qbittorrent: + image: + organization: linuxserver + repository: qbittorrent + tag: 14.2.5.99202004250119-7015-2c65b79ubuntu18.04.1-ls91 + + service: + type: ClusterIP + port: 8080 + + ingress: + enabled: false diff --git a/charts/qbittorrent/templates/NOTES.txt b/charts/qbittorrent/templates/NOTES.txt index 3c7a99d0..8e1d4d27 100644 --- a/charts/qbittorrent/templates/NOTES.txt +++ b/charts/qbittorrent/templates/NOTES.txt @@ -1,19 +1,23 @@ +{{- $svcPort := .Values.qbittorrent.service.port -}} 1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- if .Values.qbittorrent.ingress.enabled }} +{{- range .Values.qbittorrent.ingress.hosts }} + http{{ if $.Values.qbittorrent.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.qbittorrent.ingress.path }} {{- end }} -{{- else if contains "NodePort" .Values.guiService.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "qbittorrent.fullname" . }}) +{{- else if contains "NodePort" .Values.qbittorrent.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "media-common.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.guiService.type }} +{{- else if contains "LoadBalancer" .Values.qbittorrent.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ include "qbittorrent.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "qbittorrent.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.guiService.port }} -{{- else if contains "ClusterIP" .Values.guiService.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "qbittorrent.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + You can watch the status of by running 'kubectl get svc -w {{ include "media-common.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "media-common.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ $svcPort }} +{{- else if contains "ClusterIP" .Values.qbittorrent.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "media-common.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:80 + kubectl port-forward $POD_NAME 8080:{{ $svcPort }} {{- end }} + +The default login to the GUI is login:admin, password:adminadmin +You should change this as soon as possible! diff --git a/charts/qbittorrent/templates/_helpers.tpl b/charts/qbittorrent/templates/_helpers.tpl deleted file mode 100644 index 777d81b4..00000000 --- a/charts/qbittorrent/templates/_helpers.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "qbittorrent.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "qbittorrent.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "qbittorrent.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/charts/qbittorrent/templates/bt-svc.yaml b/charts/qbittorrent/templates/bt-svc.yaml deleted file mode 100644 index e4477149..00000000 --- a/charts/qbittorrent/templates/bt-svc.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "qbittorrent.fullname" . }}-bt - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - helm.sh/chart: {{ include "qbittorrent.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.btService.labels }} -{{ toYaml .Values.btService.labels | indent 4 }} -{{- end }} -{{- with .Values.btService.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if (or (eq .Values.btService.type "ClusterIP") (empty .Values.btService.type)) }} - type: ClusterIP - {{- if .Values.btService.clusterIP }} - clusterIP: {{ .Values.btService.clusterIP }} - {{end}} -{{- else if eq .Values.btService.type "LoadBalancer" }} - type: {{ .Values.btService.type }} - {{- if .Values.btService.loadBalancerIP }} - loadBalancerIP: {{ .Values.btService.loadBalancerIP }} - {{- end }} - {{- if .Values.btService.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.btService.loadBalancerSourceRanges | indent 4 }} - {{- end -}} -{{- else }} - type: {{ .Values.btService.type }} -{{- end }} -{{- if .Values.btService.externalIPs }} - externalIPs: -{{ toYaml .Values.btService.externalIPs | indent 4 }} -{{- end }} - {{- if .Values.btService.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.btService.externalTrafficPolicy }} - {{- end }} - ports: - - name: bt - port: {{ .Values.btService.port }} - protocol: TCP - targetPort: bt -{{ if (and (eq .Values.btService.type "NodePort") (not (empty .Values.btService.nodePort))) }} - nodePort: {{.Values.btService.nodePort}} -{{ end }} - selector: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/qbittorrent/templates/config-pvc.yaml b/charts/qbittorrent/templates/config-pvc.yaml deleted file mode 100644 index 36cd3c0e..00000000 --- a/charts/qbittorrent/templates/config-pvc.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if and .Values.persistence.config.enabled (not .Values.persistence.config.existingClaim) }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "qbittorrent.fullname" . }}-config - {{- if .Values.persistence.config.skipuninstall }} - annotations: - "helm.sh/resource-policy": keep - {{- end }} - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - helm.sh/chart: {{ include "qbittorrent.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - accessModes: - - {{ .Values.persistence.config.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.config.size | quote }} -{{- if .Values.persistence.config.storageClass }} -{{- if (eq "-" .Values.persistence.config.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.config.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} \ No newline at end of file diff --git a/charts/qbittorrent/templates/configmap.yaml b/charts/qbittorrent/templates/configmap.yaml new file mode 100644 index 00000000..69f469e5 --- /dev/null +++ b/charts/qbittorrent/templates/configmap.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "media-common.fullname" . }}-scripts + labels: + {{- include "media-common.labels" . | nindent 4 }} +data: + {{- if and .Values.qbittorrent.btService .Values.qbittorrent.btService.port }} + 31-update-port: |- + #!/bin/bash + QBITTORRENT_CONFIGFILE="/config/qBittorrent/qBittorrent.conf" + 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 + 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 }} diff --git a/charts/qbittorrent/templates/deployment.yaml b/charts/qbittorrent/templates/deployment.yaml deleted file mode 100644 index d2cceeaa..00000000 --- a/charts/qbittorrent/templates/deployment.yaml +++ /dev/null @@ -1,117 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "qbittorrent.fullname" . }} - {{- if .Values.deploymentAnnotations }} - annotations: - {{- range $key, $value := .Values.deploymentAnnotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} - {{- end }} - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - helm.sh/chart: {{ include "qbittorrent.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - replicas: 1 - revisionHistoryLimit: 3 - strategy: - type: {{ .Values.strategyType }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - {{- if .Values.podAnnotations }} - annotations: - {{- range $key, $value := .Values.podAnnotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} - {{- end }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: bt - containerPort: 6881 - protocol: TCP - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - tcpSocket: - port: bt - initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} - failureThreshold: {{ .Values.probes.liveness.failureThreshold }} - timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }} - readinessProbe: - tcpSocket: - port: bt - initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} - failureThreshold: {{ .Values.probes.readiness.failureThreshold }} - timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} - env: - - name: TZ - value: "{{ .Values.timezone }}" - - name: PUID - value: "{{ .Values.puid }}" - - name: PGID - value: "{{ .Values.pgid }}" - - name: UMASK_SET - value: "{{ .Values.umask }}" - volumeMounts: - - mountPath: /config - name: config - {{- if .Values.persistence.config.subPath }} - subPath: {{ .Values.persistence.config.subPath }} - {{ end }} - - mountPath: /downloads - name: downloads - {{- if .Values.persistence.downloads.subPath }} - subPath: {{ .Values.persistence.downloads.subPath }} - {{ end }} - {{- range .Values.persistence.extraMounts }} - - mountPath: /{{ .name }} - name: {{ .name }} - {{- end }} - resources: -{{ toYaml .Values.resources | indent 12 }} - volumes: - - name: config - {{- if .Values.persistence.config.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.config.existingClaim }}{{ .Values.persistence.config.existingClaim }}{{- else }}{{ template "qbittorrent.fullname" . }}-config{{- end }} - {{- else }} - emptyDir: {} - {{ end }} - - name: downloads - {{- if .Values.persistence.downloads.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.downloads.existingClaim }}{{ .Values.persistence.downloads.existingClaim }}{{- else }}{{ template "qbittorrent.fullname" . }}-downloads{{- end }} - {{- else }} - emptyDir: {} - {{ end }} - {{- range .Values.persistence.extraMounts }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ .claimName }} - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} \ No newline at end of file diff --git a/charts/qbittorrent/templates/downloads-pvc.yaml b/charts/qbittorrent/templates/downloads-pvc.yaml deleted file mode 100644 index 61f8f054..00000000 --- a/charts/qbittorrent/templates/downloads-pvc.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if and .Values.persistence.downloads.enabled (not .Values.persistence.downloads.existingClaim) }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "qbittorrent.fullname" . }}-downloads - {{- if .Values.persistence.downloads.skipuninstall }} - annotations: - "helm.sh/resource-policy": keep - {{- end }} - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - helm.sh/chart: {{ include "qbittorrent.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - accessModes: - - {{ .Values.persistence.downloads.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.downloads.size | quote }} -{{- if .Values.persistence.downloads.storageClass }} -{{- if (eq "-" .Values.persistence.downloads.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.downloads.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} \ No newline at end of file diff --git a/charts/qbittorrent/templates/gui-svc.yaml b/charts/qbittorrent/templates/gui-svc.yaml deleted file mode 100644 index e26177a1..00000000 --- a/charts/qbittorrent/templates/gui-svc.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "qbittorrent.fullname" . }}-gui - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - helm.sh/chart: {{ include "qbittorrent.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.guiService.labels }} -{{ toYaml .Values.guiService.labels | indent 4 }} -{{- end }} -{{- with .Values.guiService.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if (or (eq .Values.guiService.type "ClusterIP") (empty .Values.guiService.type)) }} - type: ClusterIP - {{- if .Values.guiService.clusterIP }} - clusterIP: {{ .Values.guiService.clusterIP }} - {{end}} -{{- else if eq .Values.guiService.type "LoadBalancer" }} - type: {{ .Values.guiService.type }} - {{- if .Values.guiService.loadBalancerIP }} - loadBalancerIP: {{ .Values.guiService.loadBalancerIP }} - {{- end }} - {{- if .Values.guiService.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.guiService.loadBalancerSourceRanges | indent 4 }} - {{- end -}} -{{- else }} - type: {{ .Values.guiService.type }} -{{- end }} -{{- if .Values.guiService.externalIPs }} - externalIPs: -{{ toYaml .Values.guiService.externalIPs | indent 4 }} -{{- end }} - {{- if .Values.guiService.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.guiService.externalTrafficPolicy }} - {{- end }} - ports: - - name: http - port: {{ .Values.guiService.port }} - protocol: TCP - targetPort: http -{{ if (and (eq .Values.guiService.type "NodePort") (not (empty .Values.guiService.nodePort))) }} - nodePort: {{.Values.guiService.nodePort}} -{{ end }} - selector: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/qbittorrent/templates/ingress.yaml b/charts/qbittorrent/templates/ingress.yaml deleted file mode 100644 index 2ca6c62c..00000000 --- a/charts/qbittorrent/templates/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "qbittorrent.fullname" . -}} -{{- $ingressPath := .Values.ingress.path -}} -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - app.kubernetes.io/name: {{ include "qbittorrent.name" . }} - helm.sh/chart: {{ include "qbittorrent.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - {{- with .Values.ingress.labels -}} - {{ toYaml . | nindent 4 }} - {{- end -}} -{{- with .Values.ingress.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ . }} - http: - paths: - - path: {{ $ingressPath }} - backend: - serviceName: {{ $fullName }}-gui - servicePort: http - {{- end }} -{{- end }} \ No newline at end of file diff --git a/charts/qbittorrent/templates/pvc.yaml b/charts/qbittorrent/templates/pvc.yaml new file mode 100644 index 00000000..9ad845f4 --- /dev/null +++ b/charts/qbittorrent/templates/pvc.yaml @@ -0,0 +1,22 @@ +{{- if and .Values.qbittorrent.persistence.downloads.enabled (not .Values.qbittorrent.persistence.downloads.existingClaim) }} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "media-common.fullname" . }}-downloads + {{- if .Values.qbittorrent.persistence.downloads.skipuninstall }} + annotations: + "helm.sh/resource-policy": keep + {{- end }} + labels: + {{- include "media-common.labels" . | nindent 4 }} +spec: + accessModes: + - {{ .Values.qbittorrent.persistence.downloads.accessMode | quote }} + resources: + requests: + storage: {{ .Values.qbittorrent.persistence.downloads.size | quote }} + {{- if .Values.qbittorrent.persistence.downloads.storageClass }} + storageClassName: {{ if (eq "-" .Values.qbittorrent.persistence.downloads.storageClass) }}""{{- else }}{{ .Values.qbittorrent.persistence.downloads.storageClass | quote}}{{- end }} + {{- end }} +{{- end -}} 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 e8017506..8509309f 100644 --- a/charts/qbittorrent/values.yaml +++ b/charts/qbittorrent/values.yaml @@ -1,157 +1,66 @@ # Default values for qbittorrent. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. -# upgrade strategy type (e.g. Recreate or RollingUpdate) -strategyType: Recreate +qbittorrent: + image: + organization: linuxserver + repository: qbittorrent + pullPolicy: IfNotPresent + tag: 14.2.5.99202004250119-7015-2c65b79ubuntu18.04.1-ls91 -# Probes configuration -probes: - liveness: - initialDelaySeconds: 60 - failureThreshold: 5 - timeoutSeconds: 10 - readiness: - initialDelaySeconds: 60 - failureThreshold: 5 - timeoutSeconds: 10 + env: + TZ: UTC + PUID: "1001" + PGID: "1001" + UMASK: "022" -nameOverride: "" -fullnameOverride: "" + service: + port: 8080 -# timezone: UTC -puid: 1001 -pgid: 1001 -umask: 022 - -image: - repository: linuxserver/qbittorrent - tag: 14.2.5.99202004250119-7015-2c65b79ubuntu18.04.1-ls89 - pullPolicy: IfNotPresent -# resources: -# requests: -# cpu: "50m" -# memory: "50Mi" -# limits: -# memory: "1Gi" - -guiService: - type: ClusterIP - port: 8080 - ## 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: {} - ## Use loadBalancerIP to request a specific static IP, - ## otherwise leave blank - ## - loadBalancerIP: - # loadBalancerSourceRanges: [] - ## Set the externalTrafficPolicy in the Service to either Cluster or Local - # externalTrafficPolicy: Cluster - -btService: - type: NodePort - 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: {} - ## Use loadBalancerIP to request a specific static IP, - ## otherwise leave blank - ## - loadBalancerIP: - # loadBalancerSourceRanges: [] - ## Set the externalTrafficPolicy in the Service to either Cluster or Local - # externalTrafficPolicy: Cluster - - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - labels: {} - path: / - hosts: - - chart-example.local - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -persistence: - config: - enabled: true - ## qbittorrent configuration data Persistent Volume Storage Class - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) + 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 ## - # storageClass: "-" + # 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 ## - ## If you want to reuse an existing claim, you can pass the name of the PVC using - ## the existingClaim variable - # existingClaim: your-claim - accessMode: ReadWriteOnce - size: 1Gi - ## If subPath is set mount a sub folder of a volume instead of the root of the volume. - ## This is especially handy for volume plugins that don't natively support sub mounting (like glusterfs). - ## - subPath: "" - ## Do not delete the pvc upon helm uninstall - skipuninstall: false - downloads: - enabled: true - ## qbittorrent torrents downloads volume configuration - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - # storageClass: "-" - ## - ## If you want to reuse an existing claim, you can pass the name of the PVC using - ## the existingClaim variable - # existingClaim: your-claim - # subPath: some-subpath - accessMode: ReadWriteOnce - size: 10Gi - ## If subPath is set mount a sub folder of a volume instead of the root of the volume. - ## This is especially handy for volume plugins that don't natively support sub mounting (like glusterfs). - ## - subPath: "" - ## Do not delete the pvc upon helm uninstall - skipuninstall: false + annotations: {} + labels: {} + additionalSpec: {} - extraMounts: [] - ## Include additional claims that can be mounted inside the - ## pod. This is useful if you wish to use different paths with categories - ## Claim will me mounted as /{name} - # - name: video - # claimName: video-claim + persistence: + downloads: + enabled: false + ## qbittorrent downloads Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + # storageClass: "-" + # accessMode: ReadWriteOnce + # size: 1Gi + ## Do not delete the pvc upon helm uninstall + # skipuninstall: false -nodeSelector: {} + additionalVolumes: + - name: qbittorrent-scripts + emptyDir: {} + ## When you want to enable automatic port configuration at startup, adjust this to: + # configMap: + # name: -scripts + # defaultMode: 511 + - name: downloads + emptyDir: {} + ## When using persistence.downloads.enabled: true, adjust this to: + # persistentVolumeClaim: + # claimName: qbittorrent-downloads -tolerations: [] - -affinity: {} - -podAnnotations: {} - -deploymentAnnotations: {} + additionalVolumeMounts: + - mountPath: /config/custom-cont-init.d + name: qbittorrent-scripts + - name: downloads + mountPath: /downloads