add the configmap with the script in it and the job creation

This commit is contained in:
2025-02-24 15:08:34 +00:00
parent 21de45e7ea
commit d789d505e3
2 changed files with 66 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
apiVersion: v1
data:
prowlarr_add_bulk_indexer.sh: |
#!/bin/bash
# Base URL and API key
BASE_URL="https://prowlarr.tryton.geeraert.eu"
API_KEY="0cb77d794ab74f158daaae044ab850ee"
APP_PROFILE_ID=1 # Set this to a valid App Profile Id
# Get the list of all available indexers
available_indexers=$(curl -s -X GET "$BASE_URL/api/v1/indexer/schema" \
-H "accept: application/json" \
-H "X-Api-Key: $API_KEY")
# Loop through each indexer and add it to Prowlarr
echo "$available_indexers" | jq -c '.[]' | while read -r indexer; do
indexer_name=$(echo "$indexer" | jq -r '.name')
indexer_settings=$(echo "$indexer" | jq -c '.')
# Add the AppProfileId to the indexer settings
indexer_settings=$(echo "$indexer_settings" | jq --argjson appProfileId "$APP_PROFILE_ID" '. + {AppProfileId: $appProfileId}')
echo "Adding indexer: $indexer_name"
curl -s -X POST "$BASE_URL/api/v1/indexer" \
-H "accept: application/json" \
-H "X-Api-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "$indexer_settings"
echo "Indexer $indexer_name added."
done
kind: ConfigMap
metadata:
creationTimestamp: null
name: prowlarr-add-bulk-indexer
+28
View File
@@ -0,0 +1,28 @@
apiVersion: batch/v1
kind: Job
metadata:
name: prowlarr-bulk-add-indexers
namespace: servarr
spec:
template:
spec:
containers:
- name: prowlarr-bulk-add-indexers
image: alpine
imagePullPolicy: Always
volumeMounts:
- mountPath: /config
name: scripts
command:
- /bin/sh
- -c
- /config/prowlarr_add_bulk_indexer.sh
# command: ["chmod","+x","/config/prowlarr_add_bulk_indexer.sh",";","./config/prowlarr_add_bulk_indexer.sh"]
restartPolicy: Never
volumes:
- configMap:
defaultMode: 365
name: prowlarr-add-bulk-indexer
name: scripts
backoffLimit: 4