ops: restart rpi agents through host namespace

This commit is contained in:
jenkins 2026-05-19 15:00:31 -03:00
parent 4be03e1514
commit bf908556bf
2 changed files with 5 additions and 3 deletions

View File

@ -15,8 +15,9 @@ spec:
labels:
app: rpi-resource-reservation
annotations:
atlas.bstein.dev/reservation-revision: "2026-05-19-3"
atlas.bstein.dev/reservation-revision: "2026-05-19-4"
spec:
hostPID: true
serviceAccountName: node-nofile
nodeSelector:
node-role.kubernetes.io/worker: "true"

View File

@ -74,6 +74,7 @@ rm -f "${kubelet_tmp_file}"
override_tmp_file="$(mktemp)"
cat > "${override_tmp_file}" <<'EOF'
# Managed by Flux via rpi_resource_reservation.sh revision 2026-05-19-4.
[Service]
UnsetEnvironment=K3S_KUBELET_ARG
ExecStart=
@ -98,8 +99,8 @@ if [ "${changed}" -eq 1 ]; then
delay="$(( (RANDOM % 420) + 30 ))"
echo "updated RPi kubelet reservations; restarting ${unit} after ${delay}s"
sleep "${delay}"
chroot "${host_root}" /bin/systemctl daemon-reload
chroot "${host_root}" /bin/systemctl restart "${unit}"
nsenter --target 1 --mount --uts --ipc --net --pid -- systemctl daemon-reload
nsenter --target 1 --mount --uts --ipc --net --pid -- systemctl restart "${unit}"
else
echo "${config_file} already up to date"
fi