You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MuxedStreamNamespacedPodExecAsync doesn't open a V5 WebSocket #1946
Describe the bug
When requesting a StreamDemuxer using MuxedStreamNamespacedPodExecAsync with webSocketSubProtocol: WebSocketProtocol.V5BinaryWebsocketProtocol, it opens a v4 websocket instead
Kubernetes C# SDK Client Version 21.0.8
Server Kubernetes Version 1.36.1
Dotnet Runtime Version
net8
To Reproduce
Steps to reproduce the behavior:
create a Kubernetes client
create a helper pod with CoreV1.CreateNamespacedPodAsync
request a MuxedStreamNamespacedPodExecAsync with webSocketSubProtocol = WebSocketProtocol.V5BinaryWebsocketProtocol
Expected behavior
Expect a websocket with protocol V5
KubeConfig
If applicable, add a KubeConfig file with secrets redacted.
Where do you run your app with Kubernetes SDK (please complete the following information):
OS: Windows, with Kubernetes in Docker Desktop
Additional context
I am using ubuntu as the helper pod
I can get a V5 websocket using WebSocketNamespacedPodExecAsync and then create a StreamDemuxer like so:
public async Task<IStreamDemuxer> MuxedStreamNamespacedPodExecAsync(
string podName,
string namespaceName,
string containerName,
IEnumerable<string> command,
CancellationToken cancellationToken = default)
{
// Make our own StreamDemuxer from a websocket
// since client.MuxedStreamNamespacedPodExecAsync does not properly open a V5 websocket
var ws = await client.WebSocketNamespacedPodExecAsync(podName, namespaceName, command, containerName, tty: false, webSocketSubProtocol: WebSocketProtocol.V5BinaryWebsocketProtocol, cancellationToken: cancellationToken);
if (ws.SubProtocol != WebSocketProtocol.V5BinaryWebsocketProtocol)
throw new InvalidOperationException($"Expected Websocket protocol V5, but got {ws.SubProtocol}");
return new StreamDemuxer(ws, StreamType.RemoteCommand, ownsSocket: true, supportsClose: true);
}
Activity