Skip to content
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

Feat: Implementing resizable/error exec stream #900

Merged
merged 1 commit into from
Apr 20, 2020

Conversation

yue9944882
Copy link
Member

Kubelet is actually exposing a set of channels in the exec webconnection:

  1. stdin
  2. stdout
  3. stderr
  4. kubelet connection error
  5. resizing

this pull adds access for the last two channel

/cc @brendandburns

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 27, 2020
@@ -349,7 +349,16 @@ static int parseExitCode(ApiClient client, InputStream inputStream) {
return -1;
}

protected static class ExecProcess extends Process {
public interface ResizableStream {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of adding these interfaces? Why not just add the methods to ExecProcess?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of adding these interfaces?

the standard interface java.lang.Process only exposes access to three streams: stdin/stdout/stderr. while for a complete implementation of "web-terminal", we will have to leave the developers public access to another stream named "resize" which tells the kubernetes exec stream to probably adjust the terminals width&height..

Why not just add the methods to ExecProcess?

it is protected. otherwise how do you think about promote it to a public inner class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my feeling is you're going to have to cast it one way or the other:

Process p = Exec.exec(...);
ResizableExecStream res = (ResizableExecStream)p;
res.getResizeStream();
...

vs

ExecProcess p = (ExecProcess) Exec.exec(...);
p.getResizeStream();

I don't see the win from the interfaces, but I could be wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i reverted the interfaces and made the class ExecProcess public w/ the new getters, wdyt?

@yue9944882 yue9944882 force-pushed the feat/exec-resize branch 2 times, most recently from 35ee3d5 to 0ebf8d5 Compare April 2, 2020 03:36
@yue9944882 yue9944882 closed this Apr 14, 2020
@yue9944882 yue9944882 reopened this Apr 14, 2020
@brendandburns
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 20, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, yue9944882

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [brendandburns,yue9944882]

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 k8s-ci-robot merged commit 970ed2b into kubernetes-client:master Apr 20, 2020
@myoss
Copy link

myoss commented May 25, 2020

@yue9944882 hello, how to usage this ? resize web terminal

ExecProcess p = (ExecProcess) Exec.exec(...);
p.getResizeStream();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants