diff --git a/charts/qbittorrent/Chart.yaml b/charts/qbittorrent/Chart.yaml new file mode 100644 index 0000000..d7b5a68 --- /dev/null +++ b/charts/qbittorrent/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: qbittorrent +version: 0.0.1 +description: Chart for qBittorrent +keywords: + - downloads + - torrent +sources: + - https://github.com/qbittorrent/qBittorrent +maintainers: + - name: alexlebens +icon: https://avatars.githubusercontent.com/u/2131270?s=48&v=4 +appVersion: version-4.6.3-r0 diff --git a/charts/qbittorrent/README.md b/charts/qbittorrent/README.md new file mode 100644 index 0000000..e3d5f84 --- /dev/null +++ b/charts/qbittorrent/README.md @@ -0,0 +1,17 @@ +## Introduction + +[qBittorrent](https://github.com/qbittorrent/qBittorrent) + +qBittorrent is a bittorrent client programmed in C++ / Qt that uses libtorrent + +This chart bootstraps a [qBittorrent](https://github.com/qbittorrent/qBittorrent) deployment on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + + +## Prerequisites + +- Kubernetes +- Helm + +## Parameters + +See the [values files](values.yaml). diff --git a/charts/qbittorrent/templates/deployment.yaml b/charts/qbittorrent/templates/deployment.yaml new file mode 100644 index 0000000..56fdc95 --- /dev/null +++ b/charts/qbittorrent/templates/deployment.yaml @@ -0,0 +1,130 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: qbittorrent + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: qbittorrent +spec: + revisionHistoryLimit: 3 + replicas: {{ .Values.server.replicas }} + strategy: + type: {{ .Values.server.strategy }} + selector: + matchLabels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + serviceAccountName: qbittorrent + automountServiceAccountToken: true + containers: + - name: qbittorrent + image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag }}" + imagePullPolicy: {{ .Values.server.image.pullPolicy }} + env: + {{- with (concat .Values.global.env .Values.server.env) }} + {{- toYaml . | nindent 12 }} + {{- end }} + - name: WEBUI_PORT + value: "{{ .Values.server.service.http.port }}" + resources: + {{- toYaml .Values.server.resources | nindent 12 }} + volumeMounts: + - name: qbittorrent-config + mountPath: /config + - name: media-storage + mountPath: {{ .Values.global.persistence.media.mountPath }} + + {{- if .Values.gluetun.enabled }} + - name: gluetun + image: "{{.Values.gluetun.image.repository}}:{{.Values.gluetun.image.tag}}" + imagePullPolicy: {{ .Values.gluetun.image.pullPolicy }} + env: + {{- with (concat .Values.global.env .Values.server.env) }} + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: health + containerPort: {{ .Values.gluetun.service.health.port }} + protocol: TCP + - name: http + containerPort: {{ .Values.server.service.http.port }} + protocol: TCP + - name: metrics + containerPort: {{ .Values.metrics.exporter.env.port }} + protocol: TCP + securityContext: + {{- toYaml .Values.gluetun.securityContext | nindent 12 }} + resources: + {{- toYaml .Values.gluetun.resources | nindent 12 }} + livenessProbe: + tcpSocket: + port: {{ .Values.gluetun.service.health.port }} + initialDelaySeconds: 0 + failureThreshold: 3 + timeoutSeconds: 1 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: {{ .Values.gluetun.service.health.port }} + initialDelaySeconds: 0 + failureThreshold: 3 + timeoutSeconds: 1 + periodSeconds: 10 + startupProbe: + tcpSocket: + port: {{ .Values.gluetun.service.health.port }} + initialDelaySeconds: 0 + failureThreshold: 30 + timeoutSeconds: 1 + periodSeconds: 5 + volumeMounts: + - name: tunnel-device + mountPath: /dev/net/tun + - name: wg0-wireguard-config + mountPath: /gluetun/wireguard/ + {{- end }} + + {{- if .Values.metrics.enabled }} + - name: exporter + image: "{{ .Values.metrics.exporter.image.repository }}:{{.Values.metrics.exporter.image.tag }}" + imagePullPolicy: {{ .Values.metrics.exporter.image.pullPolicy }} + env: + {{- with (concat .Values.global.env .Values.server.env) }} + {{- toYaml . | nindent 12 }} + {{- end }} + - name: QBITTORRENT_HOST + value: "http://localhost" + - name: QBITTORRENT_PORT + value: "{{ .Values.server.service.http.port }}" + {{- end }} + + volumes: + + {{- if .Values.gluetun.enabled }} + - name: tunnel-device + hostPath: + path: /dev/net/tun + - name: wg0-wireguard-config + secret: + secretName: qbittorrent-wireguard-secret + items: + - key: wg0.conf + path: wg0.conf + {{- end }} + + - name: qbittorrent-config + persistentVolumeClaim: + claimName: qbittorrent-config + - name: media-storage + persistentVolumeClaim: + claimName: {{ .Values.global.persistence.media.claimName }} diff --git a/charts/qbittorrent/templates/ingress.yaml b/charts/qbittorrent/templates/ingress.yaml new file mode 100644 index 0000000..cd4f636 --- /dev/null +++ b/charts/qbittorrent/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.server.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: qbittorrent + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: qbittorrent + annotations: + {{- toYaml .Values.server.ingress.annotations | nindent 4 }} +spec: + ingressClassName: {{ .Values.server.ingress.className }} + tls: + - hosts: + - {{ .Values.server.ingress.host }} + secretName: qbittorrent-secret-tls + rules: + - host: {{ .Values.server.ingress.host }} + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: qbittorrent-webui + port: + name: http +{{- end }} diff --git a/charts/qbittorrent/templates/persistent-volume-claim.yaml b/charts/qbittorrent/templates/persistent-volume-claim.yaml new file mode 100644 index 0000000..cf3585c --- /dev/null +++ b/charts/qbittorrent/templates/persistent-volume-claim.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: qbittorrent-config + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: qbittorrent +spec: + storageClassName: {{ .Values.server.persistence.config.storageClassName }} + accessModes: + - ReadWriteOnce + volumeMode: Filesystem + resources: + requests: + storage: {{ .Values.server.persistence.config.storageSize }} diff --git a/charts/qbittorrent/templates/service-account.yaml b/charts/qbittorrent/templates/service-account.yaml new file mode 100644 index 0000000..b8bf489 --- /dev/null +++ b/charts/qbittorrent/templates/service-account.yaml @@ -0,0 +1,13 @@ +{{- if .Values.global.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: qbittorrent + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: qbittorrent +{{- end }} diff --git a/charts/qbittorrent/templates/service-monitor.yaml b/charts/qbittorrent/templates/service-monitor.yaml new file mode 100644 index 0000000..758b995 --- /dev/null +++ b/charts/qbittorrent/templates/service-monitor.yaml @@ -0,0 +1,23 @@ +{{- if and .Values.metrics.enabled .Values.server.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: qbittorrent + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: qbittorrent +spec: + endpoints: + - port: metrics + interval: {{ .Values.metrics.serviceMonitor.interval }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + path: /metrics + selector: + matchLabels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/qbittorrent/templates/service.yaml b/charts/qbittorrent/templates/service.yaml new file mode 100644 index 0000000..94994a5 --- /dev/null +++ b/charts/qbittorrent/templates/service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: qbittorrent-webui + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: qbittorrent +spec: + type: ClusterIP + ports: + - port: {{ .Values.server.service.http.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: qbittorrent + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/qbittorrent/values.yaml b/charts/qbittorrent/values.yaml new file mode 100644 index 0000000..bb5f230 --- /dev/null +++ b/charts/qbittorrent/values.yaml @@ -0,0 +1,85 @@ +global: + serviceAccount: + create: true + env: [] + persistence: + media: + claimName: + mountPath: +server: + replicas: 1 + strategy: Recreate + image: + repository: linuxserver/qbittorrent + tag: "version-4.6.3-r0" + pullPolicy: IfNotPresent + env: + - name: TZ + value: UTC + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: UMASK_SET + value: "002" + resources: + requests: + cpu: 100m + memory: 2Gi + limits: + cpu: 2000m + memory: 2Gi + service: + http: + port: 8080 + ingress: + enabled: false + className: + annotations: + host: + persistence: + config: + storageClassName: + storageSize: +gluetun: + enabled: false + image: + repository: ghcr.io/qdm12/gluetun + tag: v3.37.0 + pullPolicy: IfNotPresent + securityContext: + privileged: True + capabilities: + add: + - NET_ADMIN + env: [] + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 500m + memory: 256Mi + service: + health: + port: 9999 +metrics: + enabled: false + serviceMonitor: + enabled: false + interval: 15s + scrapeTimeout: 5s + exporter: + image: + repository: esanchezm/prometheus-qbittorrent-exporter + tag: v1.5.1 + imagePullPolicy: IfNotPresent + env: + - name: QBITTORRENT_USER + value: admin + - name: QBITTORRENT_PASS + value: "" + - name: EXPORTER_PORT + value: 9022 + - name: EXPORTER_LOG_LEVEL + value: INFO