Commit 56719f83 authored by Huamin Chen's avatar Huamin Chen

when kubectl exec fails to find the container to run a command, it should retry

Signed-off-by: 's avatarHuamin Chen <hchen@redhat.com>
parent 4215fe57
...@@ -476,6 +476,12 @@ func kubectlExecWithRetry(namespace string, podName, containerName string, args ...@@ -476,6 +476,12 @@ func kubectlExecWithRetry(namespace string, podName, containerName string, args
Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes)) Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes))
continue continue
} }
if strings.Contains(strings.ToLower(string(stdErrBytes)), "container not found") {
// Retry on "container not found" errors
Logf("Warning: kubectl exec encountered container not found.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes))
time.Sleep(2 * time.Second)
continue
}
} }
return stdOutBytes, stdErrBytes, err return stdOutBytes, stdErrBytes, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment