longhorn: ensure csi tolerates oceanus
This commit is contained in:
parent
5db9dd54fc
commit
42069b0f23
@ -9,6 +9,7 @@ resources:
|
|||||||
- helmrelease.yaml
|
- helmrelease.yaml
|
||||||
- veles-recurring-jobs.yaml
|
- veles-recurring-jobs.yaml
|
||||||
- longhorn-settings-ensure-job.yaml
|
- longhorn-settings-ensure-job.yaml
|
||||||
|
- longhorn-csi-toleration-ensure-job.yaml
|
||||||
- longhorn-disk-tags-ensure-job.yaml
|
- longhorn-disk-tags-ensure-job.yaml
|
||||||
|
|
||||||
configMapGenerator:
|
configMapGenerator:
|
||||||
|
|||||||
@ -0,0 +1,65 @@
|
|||||||
|
# infrastructure/longhorn/core/longhorn-csi-toleration-ensure-job.yaml
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: longhorn-csi-toleration-ensure-1
|
||||||
|
namespace: longhorn-system
|
||||||
|
spec:
|
||||||
|
backoffLimit: 0
|
||||||
|
activeDeadlineSeconds: 240
|
||||||
|
ttlSecondsAfterFinished: 3600
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
serviceAccountName: longhorn-service-account
|
||||||
|
restartPolicy: Never
|
||||||
|
affinity:
|
||||||
|
nodeAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: kubernetes.io/arch
|
||||||
|
operator: In
|
||||||
|
values: ["arm64"]
|
||||||
|
- key: node-role.kubernetes.io/worker
|
||||||
|
operator: Exists
|
||||||
|
containers:
|
||||||
|
- name: patch
|
||||||
|
image: bitnami/kubectl@sha256:554ab88b1858e8424c55de37ad417b16f2a0e65d1607aa0f3fe3ce9b9f10b131
|
||||||
|
command: ["/bin/sh", "-c"]
|
||||||
|
args:
|
||||||
|
- |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ns="longhorn-system"
|
||||||
|
ds="longhorn-csi-plugin"
|
||||||
|
key="veles.bstein.dev/simulation"
|
||||||
|
value="true"
|
||||||
|
effect="NoSchedule"
|
||||||
|
|
||||||
|
current="$(kubectl -n "${ns}" get daemonset "${ds}" -o json)"
|
||||||
|
if echo "${current}" | jq -e \
|
||||||
|
--arg key "${key}" \
|
||||||
|
--arg value "${value}" \
|
||||||
|
--arg effect "${effect}" \
|
||||||
|
'.spec.template.spec.tolerations[]? | select(.key == $key and .value == $value and .effect == $effect)' >/dev/null; then
|
||||||
|
echo "${ds} already tolerates ${key}=${value}:${effect}"
|
||||||
|
else
|
||||||
|
patch="$(echo "${current}" | jq -c \
|
||||||
|
--arg key "${key}" \
|
||||||
|
--arg value "${value}" \
|
||||||
|
--arg effect "${effect}" \
|
||||||
|
'{
|
||||||
|
spec: {
|
||||||
|
template: {
|
||||||
|
spec: {
|
||||||
|
tolerations: ((.spec.template.spec.tolerations // []) + [
|
||||||
|
{key: $key, operator: "Equal", value: $value, effect: $effect}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}')"
|
||||||
|
kubectl -n "${ns}" patch daemonset "${ds}" --type=merge -p "${patch}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
kubectl -n "${ns}" rollout status daemonset/"${ds}" --timeout=180s
|
||||||
@ -2,7 +2,7 @@
|
|||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
name: longhorn-settings-ensure-8
|
name: longhorn-settings-ensure-9
|
||||||
namespace: longhorn-system
|
namespace: longhorn-system
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: 0
|
backoffLimit: 0
|
||||||
|
|||||||
@ -30,10 +30,25 @@ update_setting() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting ${name} -> ${value}"
|
echo "Setting ${name} -> ${value}"
|
||||||
curl ${curl_opts} -X PUT \
|
out="$(mktemp)"
|
||||||
|
if curl ${curl_opts} -o "${out}" -X PUT \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"value\":\"${value}\"}" \
|
-d "{\"value\":\"${value}\"}" \
|
||||||
"${api_base}/${name}" >/dev/null
|
"${api_base}/${name}"; then
|
||||||
|
rm -f "${out}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
current="$(curl ${curl_opts} "${api_base}/${name}" || true)"
|
||||||
|
if echo "${current}" | grep -Fq "\"value\":\"${value}\""; then
|
||||||
|
echo "Setting ${name} stored; Longhorn will apply it when current state allows."
|
||||||
|
rm -f "${out}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "${out}" >&2 || true
|
||||||
|
rm -f "${out}"
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_api
|
wait_for_api
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user