From ac97cc02f1f2d80af54c94bac2416fca48c2c5de Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Tue, 2 Jan 2024 17:36:31 -0500 Subject: [PATCH] chore: move qBit manage out of qbittorrent as a sidecar, and into its own deployment --- cluster/apps/download/kustomization.yaml | 1 + .../config.yaml} | 2 +- .../download/qbit-manage/helm-release.yaml | 76 +++++++++++++++++++ .../download/qbit-manage/kustomization.yaml | 5 ++ .../download/qbittorrent/helm-release.yaml | 45 ----------- .../download/qbittorrent/kustomization.yaml | 1 - 6 files changed, 83 insertions(+), 47 deletions(-) rename cluster/apps/download/{qbittorrent/qbit-manage-config.yaml => qbit-manage/config.yaml} (99%) create mode 100644 cluster/apps/download/qbit-manage/helm-release.yaml create mode 100644 cluster/apps/download/qbit-manage/kustomization.yaml diff --git a/cluster/apps/download/kustomization.yaml b/cluster/apps/download/kustomization.yaml index 624e2f1..40001e0 100644 --- a/cluster/apps/download/kustomization.yaml +++ b/cluster/apps/download/kustomization.yaml @@ -4,6 +4,7 @@ resources: - ./namespace.yaml #- ./network_policy.yaml - ./qbittorrent +- ./qbit-manage - ./radarr - ./sonarr - ./prowlarr diff --git a/cluster/apps/download/qbittorrent/qbit-manage-config.yaml b/cluster/apps/download/qbit-manage/config.yaml similarity index 99% rename from cluster/apps/download/qbittorrent/qbit-manage-config.yaml rename to cluster/apps/download/qbit-manage/config.yaml index 08033d0..0539bd2 100644 --- a/cluster/apps/download/qbittorrent/qbit-manage-config.yaml +++ b/cluster/apps/download/qbit-manage/config.yaml @@ -22,7 +22,7 @@ data: qbt: # qBittorrent parameters - host: "localhost:8080" + host: "qbittorrent.download:8080" user: "admin" pass: "adminadmin" diff --git a/cluster/apps/download/qbit-manage/helm-release.yaml b/cluster/apps/download/qbit-manage/helm-release.yaml new file mode 100644 index 0000000..a7dbc4c --- /dev/null +++ b/cluster/apps/download/qbit-manage/helm-release.yaml @@ -0,0 +1,76 @@ +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: qbit-manage + namespace: download +spec: + interval: 5m + chart: + spec: + chart: app-template + version: 1.3.x + sourceRef: + kind: HelmRepository + name: bjws-charts + namespace: flux-system + + values: + initContainers: + # this init container copies the read only config from the configmap volume, into + # an emptydir volume mount that the pod can write to. + copy-config: + image: alpine:3.18 + command: + - /bin/sh + - -c + - "ls /tmp/config-ro + && cp -a /tmp/config-ro/. /tmp/config/ + && chmod -R 777 /tmp/config + && ls /tmp/config" + volumeMounts: + - name: config-ro + mountPath: /tmp/config-ro + - name: config + mountPath: /tmp/config + + image: + repository: bobokun/qbit_manage + tag: "v4.0.6" + + env: + QBT_STARTUP_DELAY: 45 # seconds + QBT_SCHEDULE: 720 # 720min = 12hr + + service: + main: + enabled: false + + persistence: + storage: + enabled: true + type: hostPath + hostPath: /mnt/MainPool/Media/Torrents + mountPath: /storage/Torrents + + config: + enabled: true + type: emptyDir + mountPath: /config + + config-ro: + enabled: true + type: custom + mountPath: /config-ro + volumeSpec: + configMap: + name: qbit-manage + items: + - key: "config.yml" + path: "config.yml" + +# podSecurityContext: +# runAsNonRoot: true +# runAsUser: 10000 +# runAsGroup: 10000 +# fsGroup: 10000 +# fsGroupChangePolicy: OnRootMismatch \ No newline at end of file diff --git a/cluster/apps/download/qbit-manage/kustomization.yaml b/cluster/apps/download/qbit-manage/kustomization.yaml new file mode 100644 index 0000000..a2aa02c --- /dev/null +++ b/cluster/apps/download/qbit-manage/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./config.yaml +- ./helm-release.yaml \ No newline at end of file diff --git a/cluster/apps/download/qbittorrent/helm-release.yaml b/cluster/apps/download/qbittorrent/helm-release.yaml index 1ecec1a..0c8194c 100644 --- a/cluster/apps/download/qbittorrent/helm-release.yaml +++ b/cluster/apps/download/qbittorrent/helm-release.yaml @@ -19,22 +19,6 @@ spec: repository: lscr.io/linuxserver/qbittorrent tag: "4.5.4" - initContainers: - copy-manage-config: - image: alpine:3.18 - command: - - /bin/sh - - -c - - "ls /tmp/manage-ro - && cp -a /tmp/manage-ro/. /tmp/manage-tmp/ - && chmod -R 777 /tmp/manage-tmp - && ls /tmp/manage-tmp" - volumeMounts: - - name: manage-ro - mountPath: /tmp/manage-ro - - name: manage-tmp - mountPath: /tmp/manage-tmp - sidecars: gluetun: image: qmcgaw/gluetun:v3.36 @@ -77,17 +61,6 @@ spec: - name: metrics containerPort: 17871 - manage: - image: bobokun/qbit_manage:v4.0.6 - env: - QBT_STARTUP_DELAY: 45 # seconds - QBT_SCHEDULE: 720 # 720min = 12hr - volumeMounts: - - name: manage-tmp - mountPath: /config - - name: storage - mountPath: /storage/Torrents - env: TZ: America/New_York PGID: "10000" @@ -144,24 +117,6 @@ spec: gluetun-tmp: enabled: true type: emptyDir -# qbit-manage: -# enabled: true -# type: hostPath -# hostPath: /mnt/MainPool/Kubernetes/qbit-manage -# mountPath: /config-manage - manage-tmp: - enabled: true - type: emptyDir - manage-ro: - enabled: true - type: custom - mountPath: /config-manage - volumeSpec: - configMap: - name: qbit-manage - items: - - key: "config.yml" - path: "config.yml" resources: requests: diff --git a/cluster/apps/download/qbittorrent/kustomization.yaml b/cluster/apps/download/qbittorrent/kustomization.yaml index c87bde6..2a9073d 100644 --- a/cluster/apps/download/qbittorrent/kustomization.yaml +++ b/cluster/apps/download/qbittorrent/kustomization.yaml @@ -2,7 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ./qbittorrent-secrets.sops.yaml -- ./qbit-manage-config.yaml - ./helm-release.yaml - ./qbittorrent-metrics.yaml - ./dashboard.yaml