Skip to content

kube: fix websocket fallback logic#55696

Merged
tigrato merged 1 commit intomasterfrom
tigrato/kube-upgrade-fallback
Jun 13, 2025
Merged

kube: fix websocket fallback logic#55696
tigrato merged 1 commit intomasterfrom
tigrato/kube-upgrade-fallback

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Jun 12, 2025

Kubernetes 1.29 introduced support for the new exec over Websocket protocol. In Kubernetes 1.29, this was an alpha feature which wasn't enabled by default, but in Kubernetes 1.30 this feature flag was promoted to beta stage and enabled by default. As such, we implemented the logic to always prefer the Kubernetes exec over websocket if the Kubernetes cluster supported it. The check that verified if we should prefer the websocket was a simple Kubernetes version check and the condition was version >= 1.30.0.

For OpenShift this check is not valid as they ship Kubernetes 1.30+ with that feature disabled. Likely disabled at loadbalancer level. Given that the version check wasn't reliable for all Kubernetes supported clusters, this commit changes the logic to always use a fallback executor.

This executor initially tries to establish the websocket connection and if it fails, it will fallback to the second executor. In our case, the preferred executor is websocket and the secondary executor is SPDY.

Fixes #55695

Changelog: Fixed a bug that could cause Kubernetes exec requests to fail when the Kubernetes cluster had the WebSocket-based exec protocol disabled.

Kubernetes 1.29 introduced support for the new exec over Websocket protocol.
In Kubernetes 1.29, this was an alpha feature which wasn't enabled by
default, but in Kubernetes 1.30 this feature flag was promoted to beta
stage and enabled by default. As such, we implemented the logic to
always prefer the Kubernetes exec over websocket if the Kubernetes
cluster supported it. The check that verified if we should prefer the
websocket was a simple Kubernetes version check and the condition was
`version >= 1.30.0`.

For OpenShift this check is not valid as they ship Kubernetes 1.30+ with
that feature disabled. Likely disabled at loadbalancer level. Given that
the version check wasn't reliable for all Kubernetes supported clusters,
this commit changes the logic to always use a fallback executor.

This executor initially tries to establish the websocket connection and
if it fails, it will fallback to the second executor. In our case, the
preferred executor is websocket and the secondary executor is SPDY.

Fixes #55695

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@tigrato tigrato added this pull request to the merge queue Jun 13, 2025
Merged via the queue into master with commit d82399f Jun 13, 2025
42 of 47 checks passed
@tigrato tigrato deleted the tigrato/kube-upgrade-fallback branch June 13, 2025 16:11
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@tigrato See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Create PR
branch/v18 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kubernetes exec fail on OpenShift clusters

4 participants