Files
auricom-home-cluster/kubernetes/apps/default/qbittorrent/app/cronjob.yaml
2022-12-28 17:12:57 +01:00

43 lines
1.6 KiB
YAML

---
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.26.0@sha256:f512e3008d0492cbae7aac6eaccc21b13d723374715aaedd59d352d840f0229c
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
curl http://uptime-kuma.default.svc.cluster.local.:3001/api/push/6RUDha9bDp?status=up&msg=OK&ping=
sleep 5
else
echo "qbittorrent deployment not found"
exit 1
fi
restartPolicy: Never