From 8ef299552b5331561cbdf20792c9e6583da23d6f Mon Sep 17 00:00:00 2001 From: Andrew Sy Kim Date: Sat, 22 Aug 2020 15:15:59 -0400 Subject: [PATCH] kubelet: allow dockershim exec timeouts to be longer than 10s Signed-off-by: Andrew Sy Kim --- pkg/kubelet/dockershim/exec.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/kubelet/dockershim/exec.go b/pkg/kubelet/dockershim/exec.go index e0fb5fcebc4..8e53597c8db 100644 --- a/pkg/kubelet/dockershim/exec.go +++ b/pkg/kubelet/dockershim/exec.go @@ -117,7 +117,7 @@ func (*NativeExecHandler) ExecInContainer(client libdocker.Interface, container execTimeout = time.After(timeout) } else { // skip exec timeout if provided timeout is 0 - execTimeout = make(chan time.Time, 1) + execTimeout = nil } ticker := time.NewTicker(2 * time.Second) @@ -148,10 +148,14 @@ func (*NativeExecHandler) ExecInContainer(client libdocker.Interface, container return nil } - count++ - if count == 5 { - klog.Errorf("Exec session %s in container %s terminated but process still running!", execObj.ID, container.ID) - return nil + // Only limit the amount of InspectExec calls if the exec timeout was not set. + // When a timeout is not set, we stop polling the exec session after 5 attempts and allow the process to continue running. + if execTimeout == nil { + count++ + if count == 5 { + klog.Errorf("Exec session %s in container %s terminated but process still running!", execObj.ID, container.ID) + return nil + } } <-ticker.C