Skip to content

Commit 414c76d

Browse files
Fix K8S log reconnect timestamp tracking (#939)
Also reviewed by myself and @shanemcd
1 parent 9f05dd2 commit 414c76d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/workceptor/kubernetes.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ func podRunningAndReady() func(event watch.Event) (bool, error) {
120120
return inner
121121
}
122122

123-
func (kw *kubeUnit) kubeLoggingConnectionHandler(timestamps bool) (io.ReadCloser, error) {
123+
func (kw *kubeUnit) kubeLoggingConnectionHandler(timestamps bool, sinceTime time.Time) (io.ReadCloser, error) {
124124
var logStream io.ReadCloser
125125
var err error
126-
var sinceTime time.Time
127126
podNamespace := kw.pod.Namespace
128127
podName := kw.pod.Name
129128
podOptions := &corev1.PodLogOptions{
@@ -172,7 +171,7 @@ func (kw *kubeUnit) kubeLoggingNoReconnect(streamWait *sync.WaitGroup, stdout *S
172171
defer streamWait.Done()
173172
podNamespace := kw.pod.Namespace
174173
podName := kw.pod.Name
175-
logStream, err := kw.kubeLoggingConnectionHandler(false)
174+
logStream, err := kw.kubeLoggingConnectionHandler(false, time.Time{})
176175
if err != nil {
177176
return
178177
}
@@ -228,7 +227,7 @@ func (kw *kubeUnit) kubeLoggingWithReconnect(streamWait *sync.WaitGroup, stdout
228227
break
229228
}
230229

231-
logStream, err := kw.kubeLoggingConnectionHandler(true)
230+
logStream, err := kw.kubeLoggingConnectionHandler(true, sinceTime)
232231
if err != nil {
233232
break
234233
}

0 commit comments

Comments
 (0)