longhorn: make settings job idempotent

This commit is contained in:
Brad Stein 2026-01-16 20:15:33 -03:00
parent 42e987f4ee
commit 55992ea48f
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,7 @@
apiVersion: batch/v1
kind: Job
metadata:
name: longhorn-settings-ensure-2
name: longhorn-settings-ensure-3
namespace: longhorn-system
spec:
backoffLimit: 0

View File

@ -22,6 +22,14 @@ wait_for_api() {
update_setting() {
name="$1"
value="$2"
current="$(curl -fsS "${api_base}/${name}" || true)"
if echo "${current}" | grep -Fq "\"value\":\"${value}\""; then
echo "Setting ${name} already set."
return 0
fi
echo "Setting ${name} -> ${value}"
curl -fsS -X PUT \
-H "Content-Type: application/json" \
-d "{\"value\":\"${value}\"}" \