Skip to content

Commit 8f4fd8b

Browse files
authored
Handle EOF by check if pod is ready, Update TestKubeLoggingWithReconn… (#1357)
1 parent d0c90bd commit 8f4fd8b

2 files changed

Lines changed: 378 additions & 45 deletions

File tree

pkg/workceptor/kubernetes.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,18 @@ func (kw *KubeUnit) KubeLoggingWithReconnect(streamWait *sync.WaitGroup, stdout
371371
return
372372
}
373373

374-
if err == io.EOF {
374+
podConditionReady := false
375+
erroredPod, kubeErr := kw.KubeAPIWrapperInstance.Get(kw.GetContext(), kw.clientset, podNamespace, podName, metav1.GetOptions{})
376+
if kubeErr != nil {
377+
kw.GetWorkceptor().nc.GetLogger().Debug("Error getting pod after reading stream: '%s'", kubeErr)
378+
}
379+
for _, condition := range erroredPod.Status.Conditions {
380+
if condition.Type == corev1.PodReady && condition.Status == corev1.ConditionTrue {
381+
podConditionReady = true
382+
}
383+
}
384+
385+
if err == io.EOF && !podConditionReady {
375386
if line != "" {
376387
_, err = stdout.Write([]byte(line + "\n"))
377388
if err != nil {

0 commit comments

Comments
 (0)