Skip to main content

Module spdy

Module spdy 

Source
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.
ConnectionHandle ๐Ÿ”’
Closes or ends a connection, see Connection::handle. Once the Connection is gone, the streams the client opens get refused, the ones nobody took yet get reset.
Live ๐Ÿ”’
Counts a stream in Shared::live_streams until 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.
QueuedData ๐Ÿ”’
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.
StreamState ๐Ÿ”’
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_QUEUE frames for each of MAX_STREAMS streams 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 PingPeriod of 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.