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
Current and expected behavior
For the following code, that tries to attach to a pod running in the cluster:
We return a... less than helpful error message about upgrading the websocket:
After digging into the request, the server's response actually contains the following much more helpful error:
Possible solution
UpgradeConnectionError::ProtocolSwitchshould 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
Affected crates
kube-client
Would you like to work on fixing this bug?
None