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

Websocket upgrade error messages are discarded #1405

Open
nightkr opened this issue Feb 9, 2024 · 0 comments
Open

Websocket upgrade error messages are discarded #1405

nightkr opened this issue Feb 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nightkr
Copy link
Member

nightkr commented Feb 9, 2024

Current and expected behavior

For the following code, that tries to attach to a pod running in the cluster:

        let pods = Api::<Pod>::namespaced(..);
        let mut attachment = pods
            .attach(
                ..,
                &AttachParams::default()
                    .container(debug_container_name)
                    .stdout(true),
            )
            .await
            .context(AttachSnafu)?;

We return a... less than helpful error message about upgrading the websocket:

An unrecoverable error occured: debug command error

Caused by these errors (recent errors listed first):
 1: Attach
 2: failed to upgrade to a WebSocket connection
 3: failed to switch protocol

After digging into the request, the server's response actually contains the following much more helpful error:

rpc error: code = InvalidArgument desc = tty and stderr cannot both be true

Possible solution

UpgradeConnectionError::ProtocolSwitch should also contain (and report) the response body.

Additional context

This is from a slightly old version of kube, but looking through the changelogs I don't see a mention of this changing since.

Environment

Client Version: v1.28.4
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.3

Configuration and features

k8s-openapi v0.20.0
├── kube v0.87.1 (/home/n/Documents/stackable/stackable-admin/vendor/kube)
├── kube-client v0.87.1 (/home/n/Documents/stackable/stackable-admin/vendor/kube-client)
│   ├── kube v0.87.1 (/home/n/Documents/stackable/stackable-admin/vendor/kube) (*)
│   └── kube-runtime v0.87.1
│       └── kube v0.87.1 (/home/n/Documents/stackable/stackable-admin/vendor/kube) (*)
├── kube-core v0.87.1
│   ├── kube v0.87.1 (/home/n/Documents/stackable/stackable-admin/vendor/kube) (*)
│   └── kube-client v0.87.1 (/home/n/Documents/stackable/stackable-admin/vendor/kube-client) (*)
├── kube-runtime v0.87.1 (*)

Affected crates

kube-client

Would you like to work on fixing this bug?

None

@nightkr nightkr added the bug Something isn't working label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant