mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Do initial 0-byte write to stdout when streaming container logs
This commit is contained in:
parent
ebd44347a5
commit
0deddb1a62
@ -2484,6 +2484,14 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName string, lo
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Do a zero-byte write to stdout before handing off to the container runtime.
|
||||
// This ensures at least one Write call is made to the writer when copying starts,
|
||||
// even if we then block waiting for log output from the container.
|
||||
if _, err := stdout.Write([]byte{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return kl.containerRuntime.GetContainerLogs(pod, containerID, logOptions, stdout, stderr)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user