kubernetes icon indicating copy to clipboard operation
kubernetes copied to clipboard

Revert TerminalSize type duplication, use shared types

Open saschagrunert opened this issue 2 weeks ago • 7 comments

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

PR #133367 duplicated TerminalSize and TerminalSizeQueue types between kubectl/pkg/util/term and client-go/tools/remotecommand to avoid heavy dependencies. However, these types themselves have zero dependencies - only other files in the remotecommand package use websocket/spdystream.

This duplication broke downstream consumers that use both packages (e.g., cri-tools), requiring workarounds: https://github.com/kubernetes-sigs/cri-tools/pull/1955/files#diff-c72419df07499621d9866069c71e99656016c3149f71040424b8bd1af4e7ec07L430-R452

This change moves the types to k8s.io/apimachinery/pkg/util/remotecommand (which already contains remotecommand protocol constants) and updates both kubectl and client-go to use type aliases. This eliminates duplication while achieving the original goal of package decoupling.

Which issue(s) this PR is related to:

Refers to https://github.com/kubernetes-sigs/cri-tools/pull/1955

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

None

saschagrunert avatar Dec 04 '25 13:12 saschagrunert

Please note that we're already in Test Freeze for the release-1.35 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.35.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Dec 4 09:39:52 UTC 2025.

k8s-ci-robot avatar Dec 04 '25 13:12 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: saschagrunert Once this PR has been reviewed and has the lgtm label, please assign apelisse, seans3 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Dec 04 '25 13:12 k8s-ci-robot

cc @ash2k @soltysh

saschagrunert avatar Dec 04 '25 13:12 saschagrunert

@saschagrunert: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-apidiff-client-go 846cd35e99e3d9f4805ec17a0925dd772b0f8258 link false /test pull-kubernetes-apidiff-client-go

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

k8s-ci-robot avatar Dec 04 '25 13:12 k8s-ci-robot

@soltysh I wonder if this breakage of consumers may justify the cherry-pick to 1.35.

SergeyKanzhelev avatar Dec 04 '25 17:12 SergeyKanzhelev

/triage accepted

siyuanfoundation avatar Dec 04 '25 21:12 siyuanfoundation

FWIW I'm ok with this, but at the same time conceptually these are different things. Yes, today these types contain the same fields, but is it possible that in the future they may not be identical?

ash2k avatar Dec 04 '25 21:12 ash2k

Honestly, if we're considering a revert I'd be more comfortable reverting to a state before https://github.com/kubernetes/kubernetes/pull/133367 rather than introducing what is proposed in this PR.

soltysh avatar Dec 08 '25 16:12 soltysh

@soltysh I wonder if this breakage of consumers may justify the cherry-pick to 1.35.

That's a reasonable ask, let's sync on slack about the shape of this PR, and figure out the path forward with the release team.

soltysh avatar Dec 08 '25 16:12 soltysh

Based on the conversation on slack we've decided that a revert is not needed, the required adapter is not that big of a problem. We might consider implementing aliases, but that's not big rush.

Based on the above, I'm going to close this PR.

/close

soltysh avatar Dec 09 '25 16:12 soltysh

@soltysh: Closed this PR.

In response to this:

Based on the conversation on slack we've decided that a revert is not needed, the required adapter is not that big of a problem. We might consider implementing aliases, but that's not big rush.

Based on the above, I'm going to close this PR.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Dec 09 '25 16:12 k8s-ci-robot