From 2df830f01bcef1ee5f596dfe816a414ecbffcde2 Mon Sep 17 00:00:00 2001 From: jenkins Date: Tue, 21 Apr 2026 21:18:24 -0300 Subject: [PATCH] longhorn: bound settings sync curl calls and rerun job --- .../longhorn/core/longhorn-settings-ensure-job.yaml | 3 ++- .../longhorn/core/scripts/longhorn_settings_ensure.sh | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml b/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml index 2552b0f8..84d85cb8 100644 --- a/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml +++ b/infrastructure/longhorn/core/longhorn-settings-ensure-job.yaml @@ -2,10 +2,11 @@ apiVersion: batch/v1 kind: Job metadata: - name: longhorn-settings-ensure-5 + name: longhorn-settings-ensure-6 namespace: longhorn-system spec: backoffLimit: 0 + activeDeadlineSeconds: 240 ttlSecondsAfterFinished: 3600 template: spec: diff --git a/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh b/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh index 659ca918..fc7e45c6 100644 --- a/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh +++ b/infrastructure/longhorn/core/scripts/longhorn_settings_ensure.sh @@ -4,11 +4,12 @@ set -eu # Longhorn blocks direct CR patches for some settings; use the internal API instead. api_base="http://longhorn-backend.longhorn-system.svc:9500/v1/settings" +curl_opts="-fsS --connect-timeout 3 --max-time 15" wait_for_api() { attempts=30 while [ "${attempts}" -gt 0 ]; do - if curl -fsS "${api_base}" >/dev/null 2>&1; then + if curl ${curl_opts} "${api_base}" >/dev/null 2>&1; then return 0 fi attempts=$((attempts - 1)) @@ -22,14 +23,14 @@ update_setting() { name="$1" value="$2" - current="$(curl -fsS "${api_base}/${name}" || true)" + current="$(curl ${curl_opts} "${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 \ + curl ${curl_opts} -X PUT \ -H "Content-Type: application/json" \ -d "{\"value\":\"${value}\"}" \ "${api_base}/${name}" >/dev/null