Skip to content

Commit c158001

Browse files
authored
Merge pull request kubernetes#89825 from tosi3k/log-dump-ssh-timeout
Enable timeout for SSH-ing to non-logexported nodes
2 parents c1f1b1b + 1516016 commit c158001

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cluster/log-dump/log-dump.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,12 @@ function dump_nodes() {
420420
all_selected_nodes+=( "${windows_node_names[@]}" )
421421

422422
proc=${max_dump_processes}
423+
start="$(date +%s)"
424+
# log_dump_ssh_timeout is the maximal number of seconds the log dumping over
425+
# SSH operation can take. Please note that the logic enforcing the timeout
426+
# is only a best effort. The actual time of the operation may be longer
427+
# due to waiting for all the child processes below.
428+
log_dump_ssh_timeout_seconds="${LOG_DUMP_SSH_TIMEOUT_SECONDS:-}"
423429
for i in "${!all_selected_nodes[@]}"; do
424430
node_name="${all_selected_nodes[$i]}"
425431
node_dir="${report_dir}/${node_name}"
@@ -439,6 +445,11 @@ function dump_nodes() {
439445
if [[ proc -eq 0 ]]; then
440446
proc=${max_dump_processes}
441447
wait
448+
now="$(date +%s)"
449+
if [[ -n "${log_dump_ssh_timeout_seconds}" && $((now - start)) -gt ${log_dump_ssh_timeout_seconds} ]]; then
450+
echo "WARNING: Hit timeout after ${log_dump_ssh_timeout_seconds} seconds, finishing log dumping over SSH shortly"
451+
break
452+
fi
442453
fi
443454
done
444455
# Wait for any remaining processes.

0 commit comments

Comments
 (0)