Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set stdoutErr at the end of EOF retry #941

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/workceptor/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ func (kw *kubeUnit) kubeLoggingWithReconnect(streamWait *sync.WaitGroup, stdout
kw.GetWorkceptor().nc.GetLogger().Info(
"Context was canceled while reading logs for pod %s/%s. Assuming pod has finished",
podNamespace,
podName)
podName,
)

return
}
Expand All @@ -260,9 +261,16 @@ func (kw *kubeUnit) kubeLoggingWithReconnect(streamWait *sync.WaitGroup, stdout

break
}
*stdoutErr = err

kw.GetWorkceptor().nc.GetLogger().Error("Error reading from pod %s/%s: %s", podNamespace, podName, err)

// At this point we exausted all retries, every retry we either failed to read OR we read but did not get newer msg
// If we got a EOF on the last retry we assume that we read everything and we can stop the loop
// we ASSUME this is the happy path.
if err != io.EOF {
*stdoutErr = err
}

return
}

Expand Down Expand Up @@ -487,6 +495,7 @@ func (kw *kubeUnit) runWorkUsingLogger() {

if podName == "" {
// create new pod if ked.PodName is empty
// TODO: add retry logic to make this more resilient to transient errors
if err := kw.createPod(nil); err != nil {
if err != ErrPodCompleted {
errMsg := fmt.Sprintf("Error creating pod: %s", err)
Expand Down
Loading