hack/local-up-cluster.sh: Cleaup on SIGINT

Currently we only cleanup on exit. Let's trap SIGINT (ctrl-c) too, so we
always cleanup everything.

Otherwise if we ctrl-c is easy to leave something running, specially if
we ctrl-c while the cleanup function is running. And when we leave
something running and don't reused the certs ($REUSE_CERTS), that is the
default, something is left running and it fails with weird ways as we
can't auth with the new certs.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
This commit is contained in:
Rodrigo Campos 2023-03-08 17:37:50 +01:00
parent f99c351992
commit 5f568d51be

View File

@ -1151,6 +1151,7 @@ echo "Using GO_OUT ${GO_OUT}"
export KUBELET_CIDFILE=${TMP_DIR}/kubelet.cid
if [[ "${ENABLE_DAEMON}" = false ]]; then
trap cleanup EXIT
trap cleanup INT
fi
echo "Starting services now!"