mirror of https://github.com/k3s-io/k3s
Merge pull request #7144 from brendandburns/ssh-exit
Fix the ssh-to-node to actually fail on failures.pull/6/head
commit
ae3c83f804
|
@ -967,11 +967,15 @@ function test-teardown {
|
||||||
function ssh-to-node {
|
function ssh-to-node {
|
||||||
local node="$1"
|
local node="$1"
|
||||||
local cmd="$2"
|
local cmd="$2"
|
||||||
|
# Loop until we can successfully ssh into the box
|
||||||
for try in $(seq 1 5); do
|
for try in $(seq 1 5); do
|
||||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"; then
|
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
sleep 5
|
||||||
done
|
done
|
||||||
|
# Then actually try the command.
|
||||||
|
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart the kube-proxy on a node ($1)
|
# Restart the kube-proxy on a node ($1)
|
||||||
|
|
|
@ -238,8 +238,15 @@ function ssh-to-node() {
|
||||||
|
|
||||||
local node="$1"
|
local node="$1"
|
||||||
local cmd="$2"
|
local cmd="$2"
|
||||||
"${GCLOUD}" compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" \
|
# Loop until we can successfully ssh into the box
|
||||||
--zone="${ZONE}" "${node}" --command "${cmd}"
|
for try in $(seq 1 5); do
|
||||||
|
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
# Then actually try the command.
|
||||||
|
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart the kube-proxy on a node ($1)
|
# Restart the kube-proxy on a node ($1)
|
||||||
|
|
Loading…
Reference in New Issue