fix: wrap the TerminalSizeQueue in an adapter

This fixes an issue with the updated interface dropped in https://github.com/kubernetes/kubectl/commit/ce4d90902a18a63e073e995bee271bb23c532c5e
This commit is contained in:
Jose Diaz-Gonzalez committed 2025-12-25 20:58:24 -05:00
1 parent eb6de2f709
commit f004dafb99
1 file changed
+20 -1
+20 -1
View File
@@ -493,11 +493,30 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
Stdout: stdout, Stdout: stdout,
Stderr: stderr, Stderr: stderr,
Tty: actuallyTty, Tty: actuallyTty,
TerminalSizeQueue: sizeQueue, 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 // GetPodLogsInput contains all the information needed to get the logs for a Kubernetes pod
type GetLogsInput struct { type GetLogsInput struct {
// Name is the Kubernetes pod name // Name is the Kubernetes pod name