🚑 qbittorrent-upgrade-p2pblocklist

This commit is contained in:
auricom
2023-11-04 09:25:11 +01:00
parent d1eaf90b8d
commit b2bd47793f
4 changed files with 68 additions and 42 deletions

View File

@@ -1,40 +0,0 @@
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: &app qbittorrent-upgrade-p2pblocklist
namespace: default
spec:
schedule: "@daily"
jobTemplate:
spec:
template:
metadata:
name: *app
spec:
serviceAccountName: jobs
containers:
- name: *app
image: ghcr.io/auricom/kubectl:1.28.2@sha256:c501dc41a29b62346cc791b83e1f0d6755dcc1776b89d506f4c4a8e3fb63be41
imagePullPolicy: IfNotPresent
command:
- "/bin/bash"
- "-c"
- |
#!/bin/bash
set -o errexit
set -o nounset
curl --silent --location https://github.com/DavidMoore/ipfilter/releases/download/lists/ipfilter.dat.gz --output /tmp/ipfilter.dat.gz
gunzip /tmp/ipfilter.dat.gz
result=$(kubectl get pod --selector app.kubernetes.io/name=qbittorrent --output custom-columns=:metadata.name --namespace default)
QBITTORRENT_POD=$(echo $result | awk '{ print $NF }')
if [[ $QBITTORRENT_POD == *"qbittorrent"* ]]; then
kubectl cp /tmp/ipfilter.dat default/$QBITTORRENT_POD:/config/ipfilter.dat
kubectl rollout restart deployment qbittorrent --namespace default
else
echo "qbittorrent deployment not found"
exit 1
fi
restartPolicy: Never

View File

@@ -6,5 +6,5 @@ namespace: default
resources:
- ./gatus.yaml
- ./helmrelease.yaml
- ./jobs
- ./upgrade-p2pblocklist
- ./volsync.yaml

View File

@@ -0,0 +1,66 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/helmrelease-helm-v2beta1.json
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: qbittorrent-upgrade-p2pblocklist
namespace: default
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 2.0.3
sourceRef:
kind: HelmRepository
name: bjw-s
namespace: flux-system
maxHistory: 2
install:
createNamespace: true
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
uninstall:
keepHistory: false
values:
controllers:
main:
type: cronjob
cronjob:
concurrencyPolicy: Forbid
schedule: "@daily"
containers:
main:
image:
repository: ghcr.io/auricom/kubectl
tag: 1.28.2@sha256:c501dc41a29b62346cc791b83e1f0d6755dcc1776b89d506f4c4a8e3fb63be41
command:
- "/bin/bash"
- "-c"
- |
#!/bin/bash
set -o errexit
set -o nounset
curl --silent --location https://github.com/DavidMoore/ipfilter/releases/download/lists/ipfilter.dat.gz --output /tmp/ipfilter.dat.gz
gunzip /tmp/ipfilter.dat.gz
result=$(kubectl get pod --selector app.kubernetes.io/name=qbittorrent --output custom-columns=:metadata.name --namespace default)
QBITTORRENT_POD=$(echo $result | awk '{ print $NF }')
if [[ $QBITTORRENT_POD == *"qbittorrent"* ]]; then
kubectl cp /tmp/ipfilter.dat default/$QBITTORRENT_POD:/config/ipfilter.dat
kubectl rollout restart statefulset qbittorrent --namespace default
else
echo "qbittorrent statefulset not found"
exit 1
fi
service:
main:
enabled: false
serviceAccount:
create: false
name: "jobs"

View File

@@ -3,4 +3,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./update-p2pblocklist.yaml
- ./helmrelease.yaml