Do initial 0-byte write to stdout when streaming container logs

This commit is contained in:
Jordan Liggitt 2016-08-25 14:29:22 -04:00
parent ebd44347a5
commit 0deddb1a62
No known key found for this signature in database
GPG Key ID: 24E7ADF9A3B42012

View File

@ -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)
}