Do initial 0-byte write to stdout when streaming container logs
This commit is contained in:
@@ -2484,6 +2484,14 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName string, lo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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)
|
return kl.containerRuntime.GetContainerLogs(pod, containerID, logOptions, stdout, stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user