kubernetes/pkg/util
Kubernetes Submit Queue eeac23282d Merge pull request #31446 from liggitt/log-streaming
Automatic merge from submit-queue

Fix hang/websocket timeout when streaming container log with no content

When streaming and following a container log, no response headers are sent from the kubelet `containerLogs` endpoint until the first byte of content is written to the log. This propagates back to the API server, which also will not send response headers until it gets response headers from the kubelet. That includes upgrade headers, which means a websocket connection upgrade is not performed and can time out.

To recreate, create a busybox pod that runs `/bin/sh -c 'sleep 30 && echo foo && sleep 10'`

As soon as the pod starts, query the kubelet API:
```
curl -N -k -v 'https://<node>:10250/containerLogs/<ns>/<pod>/<container>?follow=true&limitBytes=100'
```

or the master API:
```
curl -N -k -v 'http://<master>:8080/api/v1/<ns>/pods/<pod>/log?follow=true&limitBytes=100'
```

In both cases, notice that the response headers are not sent until the first byte of log content is available.

This PR:
* does a 0-byte write prior to handing off to the container runtime stream copy. That commits the response header, even if the subsequent copy blocks waiting for the first byte of content from the log.
* fixes a bug with the "ping" frame sent to websocket streams, which was not respecting the requested protocol (it was sending a binary frame to a websocket that requested a base64 text protocol)
* fixes a bug in the limitwriter, which was not propagating 0-length writes, even before the writer's limit was reached
2016-08-26 06:09:43 -07:00
..
async Rename runnter pkg name 2016-07-29 02:37:00 -04:00
bandwidth Move ExtractPodBandwidthResources test into appropriate package 2016-07-19 14:34:08 -04:00
cache Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
certificates kubelet: '--experimental-bootstrap-kubeconfig' refactor. 2016-08-19 15:27:23 -07:00
chmod Use Go canonical import paths 2016-07-16 13:48:21 -04:00
chown Use Go canonical import paths 2016-07-16 13:48:21 -04:00
clock Refactor util clock into it's own pkg 2016-07-28 02:29:04 -04:00
codeinspector Check only predicate functions in test 2016-07-08 13:01:41 +02:00
config Update/fix feature-gate comments 2016-08-24 13:04:25 -07:00
configz Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
crlf Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
crypto kubelet: '--experimental-bootstrap-kubeconfig' refactor. 2016-08-19 15:27:23 -07:00
dbus Use Go canonical import paths 2016-07-16 13:48:21 -04:00
diff Merge pull request #28441 from smarterclayton/reflect_check 2016-07-05 05:33:28 -07:00
ebtables add ebtables util 2016-08-24 10:17:41 -07:00
env Increase coverage in pkg/util/env to 100% 2016-07-08 12:35:23 +02:00
errors Use Go canonical import paths 2016-07-16 13:48:21 -04:00
exec Add return code support to kubectl-exec and -run 2016-08-20 15:58:47 +02:00
flag Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
flock Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
flowcontrol fix go vet errors 2016-08-10 16:45:41 -07:00
flushwriter Use Go canonical import paths 2016-07-16 13:48:21 -04:00
framer Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
goroutinemap Improve godoc for goroutinemap 2016-08-25 14:25:05 -04:00
hash Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
homedir Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
httpstream Merge pull request #28816 from xiangpengzhao/add_test_comment 2016-08-23 00:19:37 -07:00
integer Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
interrupt Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
intstr Update generated files due to dependency shift. 2016-08-09 10:41:09 -05:00
io Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
iptables Merge pull request #27562 from 7ing/ipt 2016-08-02 08:02:32 -07:00
json Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
jsonpath Use Go canonical import paths 2016-07-16 13:48:21 -04:00
keymutex Run goimports 2016-08-02 15:12:39 +03:00
labels Merge pull request #26688 from asalkeld/more-unittests-util-env 2016-08-03 13:43:28 -07:00
limitwriter Make limitWriter respect 0-byte writes until limit is reached 2016-08-25 14:27:17 -04:00
logs move pkg/util/ files to their own package to reduce client-go dependencies 2016-08-05 23:32:02 -07:00
maps Add utility package for dealing with common map types 2016-08-17 10:14:33 -07:00
metrics Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
mount ensure pkg/util/mount compiles & crosses 2016-08-21 17:47:24 -07:00
net convert README.md to doc.go 2016-08-03 16:38:29 -07:00
node Remove kubelet dependency on uname 2016-08-03 17:46:02 -04:00
oom Add f.Close() for applyOOMScoreAdj 2016-07-21 13:07:30 -04:00
parsers Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
pod Print/log pointers of structs with %#v instead of %+v 2016-08-01 22:27:56 +02:00
procfs Fixes #30886 2016-08-18 17:01:03 +02:00
proxy fix go vet errors 2016-08-10 16:45:41 -07:00
rand Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
replicaset Print/log pointers of structs with %#v instead of %+v 2016-08-01 22:27:56 +02:00
resourcecontainer Update Libcontainer's Cgroup Config: AllowAllDevices to be Nil 2016-08-04 10:05:30 -07:00
rlimit Rename runnter pkg name 2016-07-29 02:37:00 -04:00
runtime Allow mounts to run in parallel for non-attachable 2016-07-19 21:54:26 -07:00
selinux Use Go canonical import paths 2016-07-16 13:48:21 -04:00
sets Support UnsortedList() in auto-generated sets. 2016-08-22 15:05:37 +02:00
slice Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
strategicpatch Merge pull request #26510 from AdoHe/patch_test 2016-08-15 20:38:22 -07:00
strings Merge pull request #26688 from asalkeld/more-unittests-util-env 2016-08-03 13:43:28 -07:00
sysctl Create testable implementation of sysctl 2016-08-23 01:42:37 -04:00
system Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
term Not to use SetWinsize in windows 2016-07-27 17:22:30 -07:00
testing Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
threading Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
uuid Refactor uuid into its own pkg 2016-07-30 00:07:02 -04:00
validation Allow leading * in ingress hostname 2016-08-03 20:16:58 -04:00
wait Fix race condition found in JitterUntil. 2016-07-28 11:41:02 -05:00
workqueue Fixed integer overflow bug in rate limiter. 2016-08-24 18:55:28 -07:00
wsstream Send ping frame using specified encoding 2016-08-25 14:24:59 -04:00
yaml Add newline to printf to fix junit 2016-08-17 10:40:27 -04:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
string_flag.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
template.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
template_test.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
trace.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
umask.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
umask_windows.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
util.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
util_test.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00