From cd64fcb88d5af135bdf74afb26c1796d1e58e36e Mon Sep 17 00:00:00 2001 From: gitea-bot Date: Wed, 17 Dec 2025 18:49:39 +0000 Subject: [PATCH] chore: Update manifests after change --- .../ConfigMap-glutun-update-script.yaml | 82 ++++++++++++++++++- .../Deployment-qbittorrent-main.yaml | 5 -- ...nt-config-data-backup-secret-external.yaml | 58 +++++++++++++ ...rrent-config-data-backup-secret-local.yaml | 58 +++++++++++++ ...rent-config-data-backup-secret-remote.yaml | 58 +++++++++++++ .../PersistentVolume-qbittorrent-config.yaml | 23 ------ ...sistentVolumeClaim-qbittorrent-config.yaml | 17 ---- ...nt-config-data-backup-source-external.yaml | 34 ++++++++ ...rrent-config-data-backup-source-local.yaml | 34 ++++++++ ...rent-config-data-backup-source-remote.yaml | 34 ++++++++ 10 files changed, 354 insertions(+), 49 deletions(-) create mode 100644 clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-external.yaml create mode 100644 clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-local.yaml create mode 100644 clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-remote.yaml delete mode 100644 clusters/cl01tl/manifests/qbittorrent/PersistentVolume-qbittorrent-config.yaml delete mode 100644 clusters/cl01tl/manifests/qbittorrent/PersistentVolumeClaim-qbittorrent-config.yaml create mode 100644 clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-external.yaml create mode 100644 clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-local.yaml create mode 100644 clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-remote.yaml diff --git a/clusters/cl01tl/manifests/qbittorrent/ConfigMap-glutun-update-script.yaml b/clusters/cl01tl/manifests/qbittorrent/ConfigMap-glutun-update-script.yaml index 3283ac05a..c96fc54e2 100644 --- a/clusters/cl01tl/manifests/qbittorrent/ConfigMap-glutun-update-script.yaml +++ b/clusters/cl01tl/manifests/qbittorrent/ConfigMap-glutun-update-script.yaml @@ -14,9 +14,83 @@ data: echo "curl could not be found, installing"; apk add curl; fi; + + if ! command -v jq 2>&1 >/dev/null + then + echo "jq could not be found, installing"; + apk add jq; + fi; + + API_ENDPOINT="http://localhost:8080/api/v2"; + + # echo " "; + # echo ">> Authentication ..."; + # curl -i --silent --header 'Referer: http://localhost:8080' --output response_body_auth.json --data 'username=admin&password=adminadmin' "${API_ENDPOINT}/auth/login" -c cookie; + + echo " "; + echo ">> Test access ..."; + HTTP_STATUS=$(curl -i -X GET --silent --write-out '%{http_code}' --output response_body_test.json -b cookie -c cookie "${API_ENDPOINT}/app/version"); + echo ">> HTTP Status Code: $HTTP_STATUS" + + VERSION=$(tail -n 1 ./test/response_body_test.json) + + if [ "$HTTP_STATUS" == "200" ]; then + echo ">> Access confirmed, qBittorrent version: ${VERSION}" + HTTP_STATUS="" + else + echo ">> ERROR: HTTP status code: $HTTP_STATUS" + exit 1 + fi + + PAYLOAD=$( jq -n \ + --arg random_port "true" \ + '{random_port: $random_port' ); + + echo " "; echo ">> Setting port to random ..."; - curl -i -X POST --silent --write-out '%{http_code}' -d "json={\"random_port\": \"true\"}" "http://localhost:8080/api/v2/app/setPreferences"; + HTTP_STATUS=$(curl -i -X POST --silent -b cookie -c cookie --write-out '%{http_code}' --output response_body_random.json --data "$PAYLOAD" "${API_ENDPOINT}/app/setPreferences"); + + if [ "$HTTP_STATUS" == "200" ]; then + echo ">> Random port set" + HTTP_STATUS="" + else + echo ">> ERROR: HTTP status code: $HTTP_STATUS" + exit 1 + fi + + echo " "; echo ">> Sleeping for changes to take effect"; - sleep 10; - echo ">> Updating port with $1 ..."; - curl -i -X POST --silent --write-out '%{http_code}' -d "json={\"listen_port\": \"${1}\"}" "http://localhost:8080/api/v2/app/setPreferences"; + sleep 5; + + PAYLOAD=$( jq -n \ + --arg listen_port "${1}" \ + '{listen_port: $listen_port' ); + + echo " "; + echo ">> Updating port with ${1} ..."; + curl -i -X POST --silent -b cookie -c cookie --write-out '%{http_code}' --output response_body_update.json --data "$PAYLOAD" "${API_ENDPOINT}/app/setPreferences"; + + if [ "$HTTP_STATUS" == "200" ]; then + echo ">> Port set" + HTTP_STATUS="" + else + echo ">> ERROR: HTTP status code: $HTTP_STATUS" + exit 1 + fi + + echo " "; + echo ">> Sleeping for changes to take effect"; + sleep 5; + + echo " "; + echo ">> Qbittorrent's post is now:"; + curl -i -X GET --silent -b cookie -c cookie --write-out '%{http_code}' --output response_body_check.json "${API_ENDPOINT}/app/preferences"; + + LISTEN_PORT=$(cat response_body_check.json | jq -r .listen_port) + + [[ "$HTTP_STATUS" == "200" || "$LISTEN_PORT" == "${1}" ]]; + echo ">> Port updated successfully!" + else + echo ">> ERROR: HTTP status code: $HTTP_STATUS" + exit 1 + fi diff --git a/clusters/cl01tl/manifests/qbittorrent/Deployment-qbittorrent-main.yaml b/clusters/cl01tl/manifests/qbittorrent/Deployment-qbittorrent-main.yaml index b6d3ac387..bde83ec7d 100644 --- a/clusters/cl01tl/manifests/qbittorrent/Deployment-qbittorrent-main.yaml +++ b/clusters/cl01tl/manifests/qbittorrent/Deployment-qbittorrent-main.yaml @@ -128,16 +128,11 @@ spec: cpu: 500m memory: 1Gi volumeMounts: - - mountPath: /config-old - name: config - mountPath: /config/qBittorrent name: config-data - mountPath: /mnt/store name: storage volumes: - - name: config - persistentVolumeClaim: - claimName: qbittorrent-config - name: config-data persistentVolumeClaim: claimName: qbittorrent-config-data diff --git a/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-external.yaml b/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-external.yaml new file mode 100644 index 000000000..9185e070b --- /dev/null +++ b/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-external.yaml @@ -0,0 +1,58 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: qbittorrent-config-data-backup-secret-external + namespace: qbittorrent + labels: + helm.sh/chart: volsync-target-config-0.5.0 + app.kubernetes.io/instance: qbittorrent + app.kubernetes.io/part-of: qbittorrent + app.kubernetes.io/version: "0.5.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: qbittorrent-config-data-backup-secret-external +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + target: + template: + mergePolicy: Merge + engineVersion: v2 + data: + RESTIC_REPOSITORY: "{{ .BUCKET_ENDPOINT }}/qbittorrent/qbittorrent-config-data" + data: + - secretKey: BUCKET_ENDPOINT + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /volsync/restic/digital-ocean + metadataPolicy: None + property: BUCKET_ENDPOINT + - secretKey: RESTIC_PASSWORD + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /volsync/restic/digital-ocean + metadataPolicy: None + property: RESTIC_PASSWORD + - secretKey: AWS_DEFAULT_REGION + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/volsync-backups + metadataPolicy: None + property: AWS_DEFAULT_REGION + - secretKey: AWS_ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/volsync-backups + metadataPolicy: None + property: AWS_ACCESS_KEY_ID + - secretKey: AWS_SECRET_ACCESS_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/volsync-backups + metadataPolicy: None + property: AWS_SECRET_ACCESS_KEY diff --git a/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-local.yaml b/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-local.yaml new file mode 100644 index 000000000..29645d777 --- /dev/null +++ b/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-local.yaml @@ -0,0 +1,58 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: qbittorrent-config-data-backup-secret-local + namespace: qbittorrent + labels: + helm.sh/chart: volsync-target-config-0.5.0 + app.kubernetes.io/instance: qbittorrent + app.kubernetes.io/part-of: qbittorrent + app.kubernetes.io/version: "0.5.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: qbittorrent-config-data-backup-secret-local +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + target: + template: + mergePolicy: Merge + engineVersion: v2 + data: + RESTIC_REPOSITORY: "{{ .BUCKET_ENDPOINT }}/qbittorrent/qbittorrent-config-data" + data: + - secretKey: BUCKET_ENDPOINT + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /volsync/restic/garage-local + metadataPolicy: None + property: BUCKET_ENDPOINT + - secretKey: RESTIC_PASSWORD + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /volsync/restic/garage-local + metadataPolicy: None + property: RESTIC_PASSWORD + - secretKey: AWS_DEFAULT_REGION + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/volsync-backups + metadataPolicy: None + property: ACCESS_REGION + - secretKey: AWS_ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/volsync-backups + metadataPolicy: None + property: ACCESS_KEY_ID + - secretKey: AWS_SECRET_ACCESS_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/volsync-backups + metadataPolicy: None + property: ACCESS_SECRET_KEY diff --git a/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-remote.yaml b/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-remote.yaml new file mode 100644 index 000000000..8a3398981 --- /dev/null +++ b/clusters/cl01tl/manifests/qbittorrent/ExternalSecret-qbittorrent-config-data-backup-secret-remote.yaml @@ -0,0 +1,58 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: qbittorrent-config-data-backup-secret-remote + namespace: qbittorrent + labels: + helm.sh/chart: volsync-target-config-0.5.0 + app.kubernetes.io/instance: qbittorrent + app.kubernetes.io/part-of: qbittorrent + app.kubernetes.io/version: "0.5.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: qbittorrent-config-data-backup-secret-remote +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + target: + template: + mergePolicy: Merge + engineVersion: v2 + data: + RESTIC_REPOSITORY: "{{ .BUCKET_ENDPOINT }}/qbittorrent/qbittorrent-config-data" + data: + - secretKey: BUCKET_ENDPOINT + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /volsync/restic/garage-remote + metadataPolicy: None + property: BUCKET_ENDPOINT + - secretKey: RESTIC_PASSWORD + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /volsync/restic/garage-remote + metadataPolicy: None + property: RESTIC_PASSWORD + - secretKey: AWS_DEFAULT_REGION + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/volsync-backups + metadataPolicy: None + property: ACCESS_REGION + - secretKey: AWS_ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/volsync-backups + metadataPolicy: None + property: ACCESS_KEY_ID + - secretKey: AWS_SECRET_ACCESS_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/volsync-backups + metadataPolicy: None + property: ACCESS_SECRET_KEY diff --git a/clusters/cl01tl/manifests/qbittorrent/PersistentVolume-qbittorrent-config.yaml b/clusters/cl01tl/manifests/qbittorrent/PersistentVolume-qbittorrent-config.yaml deleted file mode 100644 index 794a24181..000000000 --- a/clusters/cl01tl/manifests/qbittorrent/PersistentVolume-qbittorrent-config.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: qbittorrent-config - namespace: qbittorrent - labels: - app.kubernetes.io/name: qbittorrent-config - app.kubernetes.io/instance: qbittorrent - app.kubernetes.io/part-of: qbittorrent -spec: - persistentVolumeReclaimPolicy: Retain - storageClassName: nfs-client - capacity: - storage: 1Gi - accessModes: - - ReadWriteMany - nfs: - path: /volume2/Storage/Torrent/QBITTORRENT - server: synologybond.alexlebens.net - mountOptions: - - vers=4 - - minorversion=1 - - noac diff --git a/clusters/cl01tl/manifests/qbittorrent/PersistentVolumeClaim-qbittorrent-config.yaml b/clusters/cl01tl/manifests/qbittorrent/PersistentVolumeClaim-qbittorrent-config.yaml deleted file mode 100644 index 4695b40ae..000000000 --- a/clusters/cl01tl/manifests/qbittorrent/PersistentVolumeClaim-qbittorrent-config.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: qbittorrent-config - namespace: qbittorrent - labels: - app.kubernetes.io/name: qbittorrent-config - app.kubernetes.io/instance: qbittorrent - app.kubernetes.io/part-of: qbittorrent -spec: - volumeName: qbittorrent-config - storageClassName: nfs-client - accessModes: - - ReadWriteMany - resources: - requests: - storage: 1Gi diff --git a/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-external.yaml b/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-external.yaml new file mode 100644 index 000000000..4567db6dc --- /dev/null +++ b/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-external.yaml @@ -0,0 +1,34 @@ +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: qbittorrent-config-data-backup-source-external + namespace: qbittorrent + labels: + helm.sh/chart: volsync-target-config-0.5.0 + app.kubernetes.io/instance: qbittorrent + app.kubernetes.io/part-of: qbittorrent + app.kubernetes.io/version: "0.5.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: qbittorrent-config-data-backup +spec: + sourcePVC: qbittorrent-config-data + trigger: + schedule: 0 4 * * * + restic: + pruneIntervalDays: 7 + repository: qbittorrent-config-data-backup-secret-external + retain: + daily: 3 + hourly: 1 + monthly: 2 + weekly: 2 + yearly: 4 + moverSecurityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + runAsGroup: 1000 + runAsUser: 1000 + copyMethod: Snapshot + storageClassName: ceph-block + volumeSnapshotClassName: ceph-blockpool-snapshot + cacheCapacity: 1Gi diff --git a/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-local.yaml b/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-local.yaml new file mode 100644 index 000000000..2f49bf45a --- /dev/null +++ b/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-local.yaml @@ -0,0 +1,34 @@ +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: qbittorrent-config-data-backup-source-local + namespace: qbittorrent + labels: + helm.sh/chart: volsync-target-config-0.5.0 + app.kubernetes.io/instance: qbittorrent + app.kubernetes.io/part-of: qbittorrent + app.kubernetes.io/version: "0.5.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: qbittorrent-config-data-backup +spec: + sourcePVC: qbittorrent-config-data + trigger: + schedule: 0 2 * * * + restic: + pruneIntervalDays: 7 + repository: qbittorrent-config-data-backup-secret-local + retain: + daily: 3 + hourly: 1 + monthly: 2 + weekly: 2 + yearly: 4 + moverSecurityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + runAsGroup: 1000 + runAsUser: 1000 + copyMethod: Snapshot + storageClassName: ceph-block + volumeSnapshotClassName: ceph-blockpool-snapshot + cacheCapacity: 1Gi diff --git a/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-remote.yaml b/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-remote.yaml new file mode 100644 index 000000000..e1b5c4c46 --- /dev/null +++ b/clusters/cl01tl/manifests/qbittorrent/ReplicationSource-qbittorrent-config-data-backup-source-remote.yaml @@ -0,0 +1,34 @@ +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: qbittorrent-config-data-backup-source-remote + namespace: qbittorrent + labels: + helm.sh/chart: volsync-target-config-0.5.0 + app.kubernetes.io/instance: qbittorrent + app.kubernetes.io/part-of: qbittorrent + app.kubernetes.io/version: "0.5.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: qbittorrent-config-data-backup +spec: + sourcePVC: qbittorrent-config-data + trigger: + schedule: 0 3 * * * + restic: + pruneIntervalDays: 7 + repository: qbittorrent-config-data-backup-secret-remote + retain: + daily: 3 + hourly: 1 + monthly: 2 + weekly: 2 + yearly: 4 + moverSecurityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + runAsGroup: 1000 + runAsUser: 1000 + copyMethod: Snapshot + storageClassName: ceph-block + volumeSnapshotClassName: ceph-blockpool-snapshot + cacheCapacity: 1Gi