diff --git a/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml b/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml index 7c40721..f8e56cb 100644 --- a/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml +++ b/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml @@ -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 diff --git a/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh b/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh index be188b0..f73a0cc 100644 --- a/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh +++ b/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh @@ -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}\"}" \