Expand description
A SPDY/3.1 server for the streaming protocols of Kubernetes. The kubelet
proxies the upgrade of a client to the streaming server of a container
runtime unchanged. kubectl still arrives with SPDY when it connected with a
WebSocket, the API server translates its v5.channel.k8s.io and port
forwarding WebSockets to SPDY.
Only what moby/spdystream, the SPDY implementation of Kubernetes, uses is
supported: the client opens all streams, the server answers pings. There
is no flow control, spdystream ignores window updates, so the server
bounds what it buffers itself and stops reading the connection when a
stream does not take its data, or when the streams together hold
DATA_BUFFER bytes. Streams have to take their data while they wait for
something else, otherwise they hold up all others. A single stream can
hold only a part of the budget, so that a slow stream alone does not stop
the connection earlier than without it, but a few slow streams together
do.
Modulesยง
- frame ๐
- The SPDY/3.1 frames and their encoding, see https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1/.
- reader ๐
- Reads the frames of the client and hands them to the streams.
- stream ๐
- The streams of a connection, split into the halves the protocols on top use.
Structsยง
- Connection ๐
- A connection a client upgraded to SPDY/3.1.
- Connection
Handle ๐ - Closes or ends a connection, see
Connection::handle. Once theConnectionis gone, the streams the client opens get refused, the ones nobody took yet get reset. - Live ๐
- Counts a stream in
Shared::live_streamsuntil both of its halves got dropped, the stream may hold its headers and data until then. - Queued ๐
- The data frames a stream has in the data queue, and whether it got reset after them. Both share one word, so that the writer and the reset agree on who sends the RST_STREAM.
- Queued
Data ๐ - A data frame in the data queue, with the count of its stream.
- Shared ๐
- What the reader, the writer and the streams of a connection share.
- Stream
State ๐ - An open stream as the reader sees it.
Constantsยง
- ACCEPT_
QUEUE ๐ - How many accepted streams wait for
Connection::accept. - CONTROL_
QUEUE ๐ - How many control frames wait for the connection.
- DATA_
BUFFER ๐ - How many bytes of the client all streams of a connection hold together,
before the connection is not read anymore. Without it, a client could
make the server hold
STREAM_QUEUEframes for each ofMAX_STREAMSstreams which do not take their data, like the data streams of port forward requests waiting for their error streams. The part which the reader waits to place comes on top. - DATA_
QUEUE ๐ - How many data frames of all streams wait for the connection.
- MAX_
STREAMS ๐ - The most streams a client may have open at once. A Kubernetes port forward uses two per forwarded connection. A stream counts until the server let go of it, also after the client reset it, so that a client which opens and resets streams cannot make the server hold more of them.
- PING_
INTERVAL ๐ - How often the server pings the client. The kubelet sends no pings, but
client-go pings the server as often, see
PingPeriodof its SPDY transport. A client which went away shows up as a failed write, also while the reader waits for a stream which does not take its data and misses the end of the connection. - SHUTDOWN_
TIMEOUT ๐ - How long the client may take to close the connection once the server
ended it, see
Reader::drain. - STREAM_
QUEUE ๐ - How many data frames of a stream wait for the stream to take them, before the connection is not read anymore. The decoder hands on the data frames of the client in parts of at most 64 KiB, also larger ones, so a stream holds at most 1 MiB.
- WRITE_
BUFFER ๐ - How many bytes the writer collects before writing them to the connection.