From d10288e8b92f2033c1461b732b7b924054d82de9 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Thu, 11 May 2023 15:35:36 -0400 Subject: [PATCH] use helm app template for qbittorrent --- .../deployment.yaml | 7 ++ .../ingress.yaml | 0 .../qbittorrent-old/kustomization.yaml | 7 ++ .../qbittorrent-secrets.sops.yaml | 0 .../service.yaml | 5 +- .../download/qbittorrent/helm-release.yaml | 99 +++++++++++++++++++ .../download/qbittorrent/kustomization.yaml | 6 +- .../prowlarr-exportarr-metrics.yaml | 16 +++ 8 files changed, 135 insertions(+), 5 deletions(-) rename cluster/apps/download/{qbittorrent => qbittorrent-old}/deployment.yaml (87%) rename cluster/apps/download/{qbittorrent => qbittorrent-old}/ingress.yaml (100%) create mode 100644 cluster/apps/download/qbittorrent-old/kustomization.yaml rename cluster/apps/download/{qbittorrent => qbittorrent-old}/qbittorrent-secrets.sops.yaml (100%) rename cluster/apps/download/{qbittorrent => qbittorrent-old}/service.yaml (75%) create mode 100644 cluster/apps/download/qbittorrent/helm-release.yaml create mode 100644 cluster/apps/download/qbittorrent/prowlarr-exportarr-metrics.yaml diff --git a/cluster/apps/download/qbittorrent/deployment.yaml b/cluster/apps/download/qbittorrent-old/deployment.yaml similarity index 87% rename from cluster/apps/download/qbittorrent/deployment.yaml rename to cluster/apps/download/qbittorrent-old/deployment.yaml index 801973a..75360ea 100644 --- a/cluster/apps/download/qbittorrent/deployment.yaml +++ b/cluster/apps/download/qbittorrent-old/deployment.yaml @@ -53,6 +53,13 @@ spec: add: - NET_ADMIN + - name: metrics + image: caseyscarborough/qbittorrent-exporter:latest + ports: + - name: metrics + containerPort: 17871 + + volumes: - name: qbittorrent-config hostPath: diff --git a/cluster/apps/download/qbittorrent/ingress.yaml b/cluster/apps/download/qbittorrent-old/ingress.yaml similarity index 100% rename from cluster/apps/download/qbittorrent/ingress.yaml rename to cluster/apps/download/qbittorrent-old/ingress.yaml diff --git a/cluster/apps/download/qbittorrent-old/kustomization.yaml b/cluster/apps/download/qbittorrent-old/kustomization.yaml new file mode 100644 index 0000000..47a9119 --- /dev/null +++ b/cluster/apps/download/qbittorrent-old/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./qbittorrent-secrets.sops.yaml +- ./deployment.yaml +- ./service.yaml +- ./ingress.yaml \ No newline at end of file diff --git a/cluster/apps/download/qbittorrent/qbittorrent-secrets.sops.yaml b/cluster/apps/download/qbittorrent-old/qbittorrent-secrets.sops.yaml similarity index 100% rename from cluster/apps/download/qbittorrent/qbittorrent-secrets.sops.yaml rename to cluster/apps/download/qbittorrent-old/qbittorrent-secrets.sops.yaml diff --git a/cluster/apps/download/qbittorrent/service.yaml b/cluster/apps/download/qbittorrent-old/service.yaml similarity index 75% rename from cluster/apps/download/qbittorrent/service.yaml rename to cluster/apps/download/qbittorrent-old/service.yaml index 95ac16e..3aa5221 100644 --- a/cluster/apps/download/qbittorrent/service.yaml +++ b/cluster/apps/download/qbittorrent-old/service.yaml @@ -13,4 +13,7 @@ spec: ports: - name: http port: 8080 - targetPort: 8080 \ No newline at end of file + targetPort: 8080 + - name: metrics + port: 17871 + targetPort: 17871 \ No newline at end of file diff --git a/cluster/apps/download/qbittorrent/helm-release.yaml b/cluster/apps/download/qbittorrent/helm-release.yaml new file mode 100644 index 0000000..62a3443 --- /dev/null +++ b/cluster/apps/download/qbittorrent/helm-release.yaml @@ -0,0 +1,99 @@ +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: qbittorrent + namespace: download +spec: + interval: 5m + chart: + spec: + chart: app-template + version: 1.3.x + sourceRef: + kind: HelmRepository + name: bjws-charts + namespace: flux-system + + values: + image: + repository: lscr.io/linuxserver/qbittorrent + tag: latest + + # Metrics sidecar + sidecars: + gluetun: + image: qmcgaw/gluetun:latest + env: + - name: FIREWALL + value: "off" + - name: DOT + value: "off" + envFrom: + - secretRef: + name: qbittorrent-secrets + securityContext: + capabilities: + add: + - NET_ADMIN + + metrics: + image: caseyscarborough/qbittorrent-exporter:latest + ports: + - name: metrics + containerPort: 17871 + + env: + TZ: America/New_York + PGID: "1000" + PUID: "1000" + WEBUI_PORT: "8080" + + service: + main: + labels: + app: prowlarr-service + + ports: + http: + port: 8080 + + metrics: + enabled: true + port: 17871 + protocol: HTTP + + ingress: + main: + enabled: true + annotations: + cert-manager.io/cluster-issuer: letsencrypt-production + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.middlewares: traefik-authentik@kubernetescrd + hosts: + - host: &host "qbit.${SECRET_NEW_DOMAIN}" + paths: + - path: / + pathType: Prefix + tls: + - hosts: + - *host + secretName: wildcard-main-tls + + persistence: + storage: + enabled: true + type: hostPath + hostPath: /mnt/MainPool/Media/Torrents + mountPath: /storage/Torrents + config: + enabled: true + type: hostPath + hostPath: /mnt/MainPool/Kubernetes/qbittorrent + mountPath: /config + +# resources: +# requests: +# cpu: 2m +# memory: 150Mi +# limits: +# memory: 500Mi \ No newline at end of file diff --git a/cluster/apps/download/qbittorrent/kustomization.yaml b/cluster/apps/download/qbittorrent/kustomization.yaml index 47a9119..6bf3667 100644 --- a/cluster/apps/download/qbittorrent/kustomization.yaml +++ b/cluster/apps/download/qbittorrent/kustomization.yaml @@ -1,7 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ./qbittorrent-secrets.sops.yaml -- ./deployment.yaml -- ./service.yaml -- ./ingress.yaml \ No newline at end of file +- ./helm-release.yaml +- ./prowlarr-exportarr-metrics.yaml \ No newline at end of file diff --git a/cluster/apps/download/qbittorrent/prowlarr-exportarr-metrics.yaml b/cluster/apps/download/qbittorrent/prowlarr-exportarr-metrics.yaml new file mode 100644 index 0000000..689d5e9 --- /dev/null +++ b/cluster/apps/download/qbittorrent/prowlarr-exportarr-metrics.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: prowlarr-exportarr + namespace: download + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app: prowlarr-service + endpoints: + - port: metrics + interval: 3m + scrapeTimeout: 1m + path: /metrics \ No newline at end of file