Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce an API to establish channels #16

Merged
merged 5 commits into from
Aug 6, 2023
Merged

Introduce an API to establish channels #16

merged 5 commits into from
Aug 6, 2023

Conversation

danopia
Copy link
Member

@danopia danopia commented Aug 4, 2023

My goal here is to describe Kubernetes tunneling in a generic way so that it is valid for both types of tunnel transport supported by Kubernetes (SPDY/3.1 and Websockets).

Unfortunately, the two transports are given different semantics by Kubernetes.

  • The port-forward API notably doesn't allow creating proxying further TCP sockets after a Websocket is already open, so SPDY is superior for port-forward usecases.
  • The exec/attach API doesn't allow closing stdin, and thus telling a program when we're done giving it data, though this is being proposed for a future subprotocol (v5).
  • There is a binary-log WebSocket API as well, which doesn't have the stream-multiplexing semantics and is actually just a raw bytestream. There is no SPDY version of this subprotocol. This seems to exist purely to allow binary-safe pod log fetches. I'm uh, I'm not really worrying about this one.

Related:

I think I'm using the word 'channel' for the individual streams within a
connection, and the word 'tunnel' for the overall bundle of streams that
are going over a given TCP socket.
@danopia danopia marked this pull request as ready for review August 6, 2023 20:34
@danopia
Copy link
Member Author

danopia commented Aug 6, 2023

I'm not incredibly convinced about the amount of abstraction done here. Like, whenever Kubernetes decides to handle WebSocket port forwarding multiplexing, it might not fit into the limited paradigm I have here. But it describes current and near-future PodExec, PodAttach, and PortForward fine, and it should fit into PodLogs as well if there's every any demand for PodLogs over WebSocket (though I don't expect this to be the case).

One particular thing I don't like is the async ready() function on tunnels. For WebSockets it stops accepting new streams, and ideally starts processing inbound messages. But for SPDY it doesn't have anything to do because SPDY streams are independent from each other and the user can make more whenever.. So the function sorta leaks WS vs SPDY paradigms.

Oh well let's go

@danopia danopia merged commit 55ccce2 into main Aug 6, 2023
4 checks passed
@danopia danopia deleted the tunnel-api branch August 6, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant