feat(qbittorrent): auto update seedbox ip to mam
This commit is contained in:
parent
f574f70e47
commit
517cb32b10
|
@ -0,0 +1,59 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: cookie-secret
|
||||||
|
namespace: download
|
||||||
|
stringData:
|
||||||
|
mam-id: ENC[AES256_GCM,data:TQ80l82QBz+Ar0daPc57apZHg3vVTDiWcOMUdp9OjsSXQXjWBRIddN3CzAITj5RrV5BycK7XzSlUJXv6SfhJ8uxqeLbKWG1LcBaFDXj9489AsmhUKliG56rGO+GnA1tvX1yBehTDIVTytffXFeq0u4g1UCzsCiY4gypZ/m1CuthYZuZ+aFvBqIsh+P+Cqsiq8ZQOlZvzUaBZwdDznD7a9WN0DjSeIHEmY3LLcc757UgSuwYfAaE1ntEgSqEHv+BE0tjpxoRrEmk442QGopr28KMZaxOobmoey2CjnCLw/OKnGZkybkjXXfFlShxZgBZacGaH/zDGUcCFHjQZkB9Ns/bee8ZXtHxt+SnJFHwhFxbEvMtucAVDDM9XgaX517CtzscRSQ==,iv:8AvrVNV0b6PWN6U9Yx+EcwqxcMh9/Z0uBGNtCPVyGdE=,tag:Cci2Nsr0Vyy9Cs0Z+naQBw==,type:str]
|
||||||
|
mam.cookies: ENC[AES256_GCM,data:pO4LPr4gMIF8zfvOOWaJEFl4ibNglHQ+2t30X8zSZOzDZ3XUnKdn6NDEEoPv55cjzaL2LBMk0RBUVgWomVS7rYBFmSEXOrvAimwiPG4PqgZZNcvRePFeKFO6OaC8kfbarSH5kWUL2Ibgk5Qc3nB5oXuEEQSHuDdbDrmg+RGG0u5gW3gIxIXbWO+kZi15KjMhRZ12EPJNVCdnDURoWfm1sLGFV9yN0/Oo/Me5MDkiDFjRd06UaPC7ZCE561Ki1r/CRyI4SGAE8voQEgI7JfBeVwP7UzWT8nElgJfUircV3kvIeCY9s4W2pOGryRvbOd43z2t4cQwUrypFkUM0DKk/fa6caBOkuLgnCX8NXRhcsJT6iEsr408DQIyb3T09W9SMlE7BTcOJeP8dyjjTXHvJcXClHuWHQwZiMLQAF3zFKd3VUMkLISMeSvcIXnSgiGi2Wb+KP5xVy6DuAcC0AtcQTDk0v9FI3Wc+u/LHkRtY8VVirprvdyxw1K0whgRmKcKiArasl0n2X145uY9m6iWQexL4+ok8hxyknNEIvteaYm4BWBWZXKr7SP9bai+fy2AF6FLnkDMNOxxssDBr1fYqUo0OI2ptYA6A4b/gImi1n8ls1WKHu7ZJQD0hWagFW1dwV9ojOFXfYu9YGf1dLYBwNAqZJ6AY/Kl6WjFTVAMnP3Sr8ZS6lxkJgXKj1ZCEI1ZGt4lLYEjwfDNcYfcOH5yIhEjcbcOAY1pFk9keMtVe8qsQ5Qc7MF64MmmMHLOF5FvD7my/ZR8q3FRR,iv:OaMZU6rgeNU1kox3oRIUPiqvVBIvoM0VDtlgERCr9WU=,tag:LdYAudLM8NqaXT3osT2FAw==,type:str]
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age: []
|
||||||
|
lastmodified: "2023-09-01T00:39:13Z"
|
||||||
|
mac: ENC[AES256_GCM,data:8yDxYq4ZbA+GVmwN38OTNjeq+16rRVVOlVVM7+5vTlE07Pk9vzFBhwr+J8K+72TzIHQs0xjpKa7s9kscF8Jr0SrUcfefVIMHqJQ1hpZAL3f5WimMbfCQL7HxFi5Rb0ghFSTYWppemM0OrY+mrEgy+N4q430AjphJDoNbq86utm4=,iv:rh0vAR5Nwx0tMNHbVWGp1r7iZtRjRZDVXdd9liC13gE=,tag:z8NgaLlELP3xtNGzQr04cg==,type:str]
|
||||||
|
pgp:
|
||||||
|
- created_at: "2023-09-01T00:39:12Z"
|
||||||
|
enc: |
|
||||||
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
|
hQIMAzKleRwoSoixAQ/7B9YY1WjXQATqzuVhr/cQCG7b0JjjZpBKxNYGmsCtsdnY
|
||||||
|
GLqqFgO5B33d9XKon7EspCvZpQNS4GpsqI79TcUjHq3cO11rHL6hnm4+eytPuPvC
|
||||||
|
+jQP1Hcg+aUzLL2Mv1h0mCvlYwHBICcDvYtEiMu9W4z4ovfNy1i6+et+YtYV6d0k
|
||||||
|
9LTP/hetcpe/RFQVX9cepsDDkLCyYLkrU+qXi8fSxXsZErXX6ynwKA+g2ySHXdY8
|
||||||
|
ce5/7WkbMIysqI7SW07t0ouX2Xes1vP9rOy5R3+3BMIKuxzTl2iUhLJdT9wGNb0+
|
||||||
|
WOo3DSxOkRcEKDtFPEU8kZ67lYXeCAVNu7ShCP0ZT6lqXuTQS6J0OYz+jogvz13W
|
||||||
|
p2oq7YUVAHN5QvkGvnBiJpHLQSU5njxKwZIgL2J0bhCB/XzAsc+J+5DsOlO6x2ok
|
||||||
|
X68mhuMrHpT2is5yItsYjbENgsN38gDB8oKcEaR2VyIGPx3QcHi6tUVGzb3ewqvi
|
||||||
|
L5mEudaw4R+1em6mvC4CoP4OuyjuG2eBnweLXfptoGI9n9YmuGBA6MYeNyK+YBq7
|
||||||
|
6TGdlGMRWtycmCae0t2I9fkkuDewRqizcniTMWbr7EHUoHBH4LwsRiKoFyivpp0z
|
||||||
|
Rxx2mNI+0a9WEoO5nisL0oNbVo4/7dIJJT3NLKfhkWxSot8V39lv9VdTqd2VQPzS
|
||||||
|
XgH2qjWg2AtfK2eSFIzOcAEcKXJeNkxmKdDxkNh6kYvoy9xfEJHErbB41IRVDwLv
|
||||||
|
eDN/rJsDKqhjW5+EKX5Cp2ar2vHy580IU8TIKtowVehRygiE/sR2+3s8XDBDKeE=
|
||||||
|
=MjPB
|
||||||
|
-----END PGP MESSAGE-----
|
||||||
|
fp: 2CC2B3631D5C3393901335DB68F95C5D753EE1E5
|
||||||
|
- created_at: "2023-09-01T00:39:12Z"
|
||||||
|
enc: |
|
||||||
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
|
hQIMAy5t8IMoPu4VAQ//ZCb3SYMQNXy4xfPM75uC7MiEFA7eJhLghkd0+C8ATp/c
|
||||||
|
4hIHrDwdshIb+0grhztwB40ZEe/ZdHLt+wCwJsW8BDj9NXGyFq9RkIq0ZW32+mbc
|
||||||
|
dtyDYjo65dnP0KEz/mS2yp+warvEYGhsDfepemHen36QZ8q18FrUqghpBRdF3F4Z
|
||||||
|
+JbPIB7QcnqPhJSmf1Xv/FeIWhoD4Z0KkpdxkqhQa6Pe8d3BUPr1+D4tpwCQ60pZ
|
||||||
|
lV5m78Pk1GqUFTvLALm826WpN4TTTaKJUlkgeGrK0eSG9eFw4VA9Q1opmkb4u24D
|
||||||
|
5UpFhfhznfbtxjBlbmrvL/y/Nj6b9iRkUs8bjT/OlOGLa2e5mZo0gPCzGid/BI4f
|
||||||
|
bQWceOKVHbKtMwHLBmGIWZqiyJx1giqbyy7UheiX3lHc4gF5cRQf4EUNFbd/o8UO
|
||||||
|
1PpPJObTI0dN8jO2rv6f8jFx6t2pD1dEV+GcHP6PLyfMc5E+B4BCJ4MWnHxjs3Gl
|
||||||
|
75DNyBHAWloDn6dbPHdu+U2FJfqRLtBfmyA9Gv/l4UXFx2k0wAEMAennM6HMsQe/
|
||||||
|
7zDBjO12sSCLYc7Q0E4JOCdGqUbKNzP/wfuzah46XOHJ9HLFbtEv7qS7I/1JgDfl
|
||||||
|
bjmRYs1E/D6lqoQRu/Y3+qo0qH10jH8O8qjYgBpxdSc9GNlK7XDxWAUjH5sos//S
|
||||||
|
XgGBK56/N639Me5UbslKzjD0N5iMfQa8FWjhxmBDLZzRXrbI2iIi+aWGPeQqLElg
|
||||||
|
Wt2wzlRY3UmQ//QfviDo9QwtErFcNcGnB+BZL+CB8vwsSuxya2Tm8se8Up4TcQI=
|
||||||
|
=yx+q
|
||||||
|
-----END PGP MESSAGE-----
|
||||||
|
fp: 687802D4DFD8AA82EA55666CF7DADAC782D7663D
|
||||||
|
encrypted_regex: ^(data|stringData)$
|
||||||
|
version: 3.7.3
|
|
@ -93,6 +93,11 @@ spec:
|
||||||
type: hostPath
|
type: hostPath
|
||||||
hostPath: /mnt/MainPool/Kubernetes/qbittorrent
|
hostPath: /mnt/MainPool/Kubernetes/qbittorrent
|
||||||
mountPath: /config
|
mountPath: /config
|
||||||
|
cookies:
|
||||||
|
enabled: true
|
||||||
|
type: secret
|
||||||
|
name: cookie-secret
|
||||||
|
mountPath: /etc/tokens
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
|
|
|
@ -4,4 +4,7 @@ resources:
|
||||||
- ./qbittorrent-secrets.sops.yaml
|
- ./qbittorrent-secrets.sops.yaml
|
||||||
- ./helm-release.yaml
|
- ./helm-release.yaml
|
||||||
- ./qbittorrent-metrics.yaml
|
- ./qbittorrent-metrics.yaml
|
||||||
- ./dashboard.yaml
|
- ./dashboard.yaml
|
||||||
|
- ./cookie-secret.sops.yaml
|
||||||
|
- ./updateip-script.yaml
|
||||||
|
- ./updateip-job.yaml
|
|
@ -0,0 +1,68 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: updateip-sa
|
||||||
|
namespace: download
|
||||||
|
---
|
||||||
|
kind: Role
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: updateip-role
|
||||||
|
namespace: download
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods"]
|
||||||
|
verbs: ["get", "list"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods/exec"]
|
||||||
|
verbs: ["create", "delete"]
|
||||||
|
---
|
||||||
|
kind: RoleBinding
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: updateip-rolebinding
|
||||||
|
namespace: download
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: updateip-sa
|
||||||
|
apiGroup: ""
|
||||||
|
roleRef:
|
||||||
|
kind: Role
|
||||||
|
name: updateip-role
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
---
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: updateip-job
|
||||||
|
namespace: download
|
||||||
|
spec:
|
||||||
|
# 0am every day
|
||||||
|
schedule: "0 0 * * *"
|
||||||
|
successfulJobsHistoryLimit: 1
|
||||||
|
failedJobsHistoryLimit: 2
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
serviceAccountName: updateip-sa
|
||||||
|
containers:
|
||||||
|
- name: update-ip
|
||||||
|
image: bitnami/kubectl:latest
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /mnt/scripts/updateip.sh
|
||||||
|
volumeMounts:
|
||||||
|
- name: scripts
|
||||||
|
mountPath: /mnt/scripts
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 10000
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
volumes:
|
||||||
|
- name: scripts
|
||||||
|
configMap:
|
||||||
|
name: updateip
|
||||||
|
defaultMode: 0777
|
|
@ -0,0 +1,19 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: updateip
|
||||||
|
namespace: download
|
||||||
|
data:
|
||||||
|
updateip.sh: |
|
||||||
|
#!/bin/bash
|
||||||
|
echo 'getting pod name'
|
||||||
|
POD_NAME=$(kubectl get pods -n download --selector "app.kubernetes.io/name=qbittorrent" --output=jsonpath={.items..metadata.name})
|
||||||
|
echo $POD_NAME
|
||||||
|
OUTPUT=$(kubectl exec -it $POD_NAME -n download -- MAM_ID="$(cat /etc/tokens/mam-id)"; curl -i -c /etc/mam.cookies -b "mam_id=$MAM_ID" https://t.myanonamouse.net/json/dynamicSeedbox.php)
|
||||||
|
echo $OUTPUT
|
||||||
|
if [[ $OUTPUT == *"Success\":true"* ]]; then
|
||||||
|
echo "Success"
|
||||||
|
else
|
||||||
|
echo "Failure"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue