longhorn: make settings job idempotent
This commit is contained in:
parent
42e987f4ee
commit
55992ea48f
@ -2,7 +2,7 @@
|
|||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
name: longhorn-settings-ensure-2
|
name: longhorn-settings-ensure-3
|
||||||
namespace: longhorn-system
|
namespace: longhorn-system
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: 0
|
backoffLimit: 0
|
||||||
|
|||||||
@ -22,6 +22,14 @@ wait_for_api() {
|
|||||||
update_setting() {
|
update_setting() {
|
||||||
name="$1"
|
name="$1"
|
||||||
value="$2"
|
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 \
|
curl -fsS -X PUT \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"value\":\"${value}\"}" \
|
-d "{\"value\":\"${value}\"}" \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user