Add connect timeout to ssh-to-node.

This commit is contained in:
Joe Finney 2016-03-07 13:29:04 -08:00
parent 7a43808143
commit e660adbad8
4 changed files with 8 additions and 6 deletions

View File

@ -1511,10 +1511,12 @@ function ssh-to-node {
fi fi
for try in $(seq 1 5); do for try in $(seq 1 5); do
if ssh -oLogLevel=quiet -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "${cmd}"; then if ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "echo test > /dev/null"; then
break break
fi fi
sleep 5
done done
ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "${cmd}"
} }
# Restart the kube-proxy on a node ($1) # Restart the kube-proxy on a node ($1)

View File

@ -1319,13 +1319,13 @@ function ssh-to-node {
local cmd="$2" local cmd="$2"
# Loop until we can successfully ssh into the box # 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 "echo test > /dev/null"; then if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
break break
fi fi
sleep 5 sleep 5
done done
# Then actually try the command. # Then actually try the command.
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}" gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
} }
# Restart the kube-proxy on a node ($1) # Restart the kube-proxy on a node ($1)

View File

@ -263,13 +263,13 @@ function ssh-to-node() {
local cmd="$2" local cmd="$2"
# Loop until we can successfully ssh into the box # 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 "echo test > /dev/null"; then if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
break break
fi fi
sleep 5 sleep 5
done done
# Then actually try the command. # Then actually try the command.
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}" gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
} }
# Restart the kube-proxy on a node ($1) # Restart the kube-proxy on a node ($1)

View File

@ -345,7 +345,7 @@ function ssh-to-node {
if [[ -z "$machine" ]]; then if [[ -z "$machine" ]]; then
echo "$node is an unknown machine to ssh to" >&2 echo "$node is an unknown machine to ssh to" >&2
fi fi
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no "core@$machine" "$cmd" ssh -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no "core@$machine" "$cmd"
} }
# Restart the kube-proxy on a node ($1) # Restart the kube-proxy on a node ($1)