2026-06-09 01:53:04 -03:00
|
|
|
# infrastructure/longhorn/core/longhorn-csi-toleration-ensure-job.yaml
|
|
|
|
|
apiVersion: batch/v1
|
|
|
|
|
kind: Job
|
|
|
|
|
metadata:
|
2026-06-09 01:55:02 -03:00
|
|
|
name: longhorn-csi-toleration-ensure-2
|
2026-06-09 01:53:04 -03:00
|
|
|
namespace: longhorn-system
|
|
|
|
|
spec:
|
|
|
|
|
backoffLimit: 0
|
|
|
|
|
activeDeadlineSeconds: 240
|
|
|
|
|
ttlSecondsAfterFinished: 3600
|
|
|
|
|
template:
|
|
|
|
|
spec:
|
|
|
|
|
serviceAccountName: longhorn-service-account
|
|
|
|
|
restartPolicy: Never
|
2026-06-09 01:55:02 -03:00
|
|
|
nodeSelector:
|
|
|
|
|
kubernetes.io/hostname: titan-11
|
2026-06-09 01:53:04 -03:00
|
|
|
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
|