From 30e30d6719e65c5c470a2f9147dfca0f246f46ac Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sat, 14 Dec 2024 14:22:01 -0500 Subject: [PATCH] chore: update qbit-manage, update app-template, use kustomization --- .../main/apps/download/kustomization.yaml | 2 +- .../qbit-manage/{ => app}/config.yaml | 1 - .../qbit-manage/app/helm-release.yaml | 74 ++++++++++++++++++ .../qbit-manage/{ => app}/kustomization.yaml | 0 .../download/qbit-manage/helm-release.yaml | 77 ------------------- .../main/apps/download/qbit-manage/ks.yaml | 30 ++++++++ 6 files changed, 105 insertions(+), 79 deletions(-) rename kubernetes/main/apps/download/qbit-manage/{ => app}/config.yaml (99%) create mode 100644 kubernetes/main/apps/download/qbit-manage/app/helm-release.yaml rename kubernetes/main/apps/download/qbit-manage/{ => app}/kustomization.yaml (100%) delete mode 100644 kubernetes/main/apps/download/qbit-manage/helm-release.yaml create mode 100644 kubernetes/main/apps/download/qbit-manage/ks.yaml diff --git a/kubernetes/main/apps/download/kustomization.yaml b/kubernetes/main/apps/download/kustomization.yaml index f3f5263..c879d98 100644 --- a/kubernetes/main/apps/download/kustomization.yaml +++ b/kubernetes/main/apps/download/kustomization.yaml @@ -4,7 +4,7 @@ resources: - ./namespace.yaml #- ./network_policy.yaml - ./qbittorrent/ks.yaml -- ./qbit-manage +- ./qbit-manage/ks.yaml - ./radarr/ks.yaml - ./sonarr/ks.yaml - ./prowlarr diff --git a/kubernetes/main/apps/download/qbit-manage/config.yaml b/kubernetes/main/apps/download/qbit-manage/app/config.yaml similarity index 99% rename from kubernetes/main/apps/download/qbit-manage/config.yaml rename to kubernetes/main/apps/download/qbit-manage/app/config.yaml index 6dfebc3..0a6d061 100644 --- a/kubernetes/main/apps/download/qbit-manage/config.yaml +++ b/kubernetes/main/apps/download/qbit-manage/app/config.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: qbit-manage - namespace: download data: config.yml: |- commands: diff --git a/kubernetes/main/apps/download/qbit-manage/app/helm-release.yaml b/kubernetes/main/apps/download/qbit-manage/app/helm-release.yaml new file mode 100644 index 0000000..8e1a0ef --- /dev/null +++ b/kubernetes/main/apps/download/qbit-manage/app/helm-release.yaml @@ -0,0 +1,74 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: qbit-manage +spec: + interval: 5m + chart: + spec: + chart: app-template + version: 3.5.1 + sourceRef: + kind: HelmRepository + name: bjws-charts + namespace: flux-system + values: + controllers: + main: + pod: + securityContext: + runAsNonRoot: true + runAsUser: 10000 + runAsGroup: 10000 + fsGroup: 10000 + fsGroupChangePolicy: OnRootMismatch + initContainers: + copy-config: + image: + repository: alpine + tag: 3.20 + command: + - /bin/sh + - -c + - "ls /tmp/config-ro + && cp -r /tmp/config-ro/. /tmp/config/ + && chmod 777 /tmp/config/config.yml + && ls /tmp/config" + containers: + app: + image: + repository: bobokun/qbit_manage + tag: v4.1.14 + env: + QBT_STARTUP_DELAY: 45 # seconds + QBT_SCHEDULE: 720 # 720min = 12hr + + persistence: + storage: + type: hostPath + hostPath: /mnt/MainPool/Media/Torrents + globalMounts: + - path: /storage/Torrents + config: + type: emptyDir + advancedMounts: + main: # controller name + app: # container name + - path: /config + copy-config: # container name + - path: /tmp/config + # Create tmp mount of configmap that is copied to config. + # + # This is done since qbit-manage requires the /config directory to be writable, + # but ConfigMap mounts are always readonly. + config-tmp: + type: configMap + name: qbit-manage + items: + - key: config.yml + path: config.yml + advancedMounts: + main: # controller name + copy-config: # container name + - path: /tmp/config-ro diff --git a/kubernetes/main/apps/download/qbit-manage/kustomization.yaml b/kubernetes/main/apps/download/qbit-manage/app/kustomization.yaml similarity index 100% rename from kubernetes/main/apps/download/qbit-manage/kustomization.yaml rename to kubernetes/main/apps/download/qbit-manage/app/kustomization.yaml diff --git a/kubernetes/main/apps/download/qbit-manage/helm-release.yaml b/kubernetes/main/apps/download/qbit-manage/helm-release.yaml deleted file mode 100644 index 7a24749..0000000 --- a/kubernetes/main/apps/download/qbit-manage/helm-release.yaml +++ /dev/null @@ -1,77 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2 -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.20 - command: - - /bin/sh - - -c - - "ls /tmp/config-ro - && cp -r /tmp/config-ro/. /tmp/config/ - && chmod 777 /tmp/config/config.yml - && ls /tmp/config" - volumeMounts: - - name: config-ro - mountPath: /tmp/config-ro - - name: config - mountPath: /tmp/config - - image: - repository: bobokun/qbit_manage - tag: "v4.1.13" - - 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 - defaultMode: 777 - 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/kubernetes/main/apps/download/qbit-manage/ks.yaml b/kubernetes/main/apps/download/qbit-manage/ks.yaml new file mode 100644 index 0000000..2cc969b --- /dev/null +++ b/kubernetes/main/apps/download/qbit-manage/ks.yaml @@ -0,0 +1,30 @@ +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: qbit-manage + namespace: flux-system +spec: + timeout: 5m + interval: 10m + targetNamespace: download + path: ./kubernetes/main/apps/download/qbit-manage/app + prune: true + sourceRef: + kind: GitRepository + name: home-cluster + decryption: + provider: sops + secretRef: + name: sops-gpg + dependsOn: + - name: openebs + - name: openebs-sc + - name: volsync + - name: qbittorrent + postBuild: + substituteFrom: + - kind: ConfigMap + name: cluster-settings + - kind: Secret + name: cluster-secrets