From f004dafb99a8d7c3358fb31ab6263d395f577f11 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 25 Dec 2025 20:58:24 -0500 Subject: [PATCH] fix: wrap the TerminalSizeQueue in an adapter This fixes an issue with the updated interface dropped in https://github.com/kubernetes/kubectl/commit/ce4d90902a18a63e073e995bee271bb23c532c5e --- plugins/scheduler-k3s/k8s.go | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/plugins/scheduler-k3s/k8s.go b/plugins/scheduler-k3s/k8s.go index 14ee6002b..46cf92c87 100644 --- a/plugins/scheduler-k3s/k8s.go +++ b/plugins/scheduler-k3s/k8s.go @@ -489,15 +489,34 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu } return exec.StreamWithContext(ctx, remotecommand.StreamOptions{ - Stdin: os.Stdin, - Stdout: stdout, - Stderr: stderr, - Tty: actuallyTty, - TerminalSizeQueue: sizeQueue, + Stdin: os.Stdin, + Stdout: stdout, + Stderr: stderr, + Tty: actuallyTty, + TerminalSizeQueue: &terminalSizeQueueAdapter{ + delegate: sizeQueue, + }, }) }) } +// terminalSizeQueueAdapter is an adapter for the terminal size queue to the remotecommand.TerminalSizeQueue interface +type terminalSizeQueueAdapter struct { + delegate term.TerminalSizeQueue +} + +// Next returns the next terminal size +func (a *terminalSizeQueueAdapter) Next() *remotecommand.TerminalSize { + next := a.delegate.Next() + if next == nil { + return nil + } + return &remotecommand.TerminalSize{ + Width: next.Width, + Height: next.Height, + } +} + // GetPodLogsInput contains all the information needed to get the logs for a Kubernetes pod type GetLogsInput struct { // Name is the Kubernetes pod name