-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support terminal resizing for exec/attach/run #25273
Conversation
@kubernetes/rh-cluster-infra @lavalamp @smarterclayton @liggitt |
@stefwalter @kubernetes/rh-ux @kubernetes/kubectl FYI |
I'm going to need to figure out how to support Windows as it doesn't do SIGWINCH. It looks like https://github.com/nsf/termbox-go can do it, but I don't think we need/want to pull that in as it does a lot more than what we strictly require. |
@ncdc docker seems to just do this within a go routine in a for loop, https://github.com/docker/docker/blob/7fd53f7c711474791ce4292326e0b1dc7d4d6b0f/api/client/utils.go#L118 |
83ea429
to
e8ea557
Compare
@sttts feel free to review :-) |
} | ||
} | ||
|
||
func (e *streamProtocolV1) stream(conn streamCreator) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e
is a strange abbreviation for streamProtocolV1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might have been an executor
before. It probably is worth renaming.
return channels | ||
} | ||
|
||
func createReadChannel(real bool) wsstream.ChannelType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not actually creating anything.
@ncdc this is what I see in windows... However, in general, terminal support in a windows command prompt is bad. Character codes for backspace, clear, etc don't work. Maybe it's just a matter of setting the value for TERM, but so far the values I tried haven't worked (ansi, xterm, pcansi) |
On a PowerShell window, TERM=xterm works. However, same issue with the resizing as on a regular command window. |
"k8s.io/kubernetes/pkg/util/runtime" | ||
) | ||
|
||
func monitorResizeEvents(fd uintptr, resizeEvents chan<- Size, stop chan struct{}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
godoc on these functions
82bfa32
to
583b838
Compare
(I'll be happy to cherry-pick and deploy this on our cluster when it's merged :D) |
Ok, I want soak time on this. Squash and LGTM and I'll label it. |
Add support for terminal resizing for exec, attach, and run. Note that for Docker, exec sessions inherit the environment from the primary process, so if the container was created with tty=false, that means the exec session's TERM variable will default to "dumb". Users can override this by setting TERM=xterm (or whatever is appropriate) to get the correct "smart" terminal behavior.
Squashed |
GCE e2e build/test passed for commit 3b21a99. |
1 similar comment
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 3b21a99. |
Automatic merge from submit-queue |
/cc @kubernetes/sig-node |
Do you think this could possibly be cherry-picked onto 1.3.4? I can't seem to rebase easily.. |
Fixes #13585