-
Notifications
You must be signed in to change notification settings - Fork 2k
Add support for PortForward. #91
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
Add support for PortForward. #91
Conversation
8438bde
to
52c57cd
Compare
streamRequest(request, client, listener); | ||
} | ||
|
||
/** If we ever upgrade to okhttp 3... |
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.
I think this might get interpreted as a javadoc with that extra *
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.
done.
public OutputStream getOutboundStream(int port) { | ||
int portIndex = findPortIndex(port); | ||
if (portIndex == -1) { | ||
throw new IllegalArgumentException("No such port!"); |
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.
Would it be neater to have findPortIndex(..)
throw this exception instead?
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.
switched to return null instead of throw.
WebSocketStreamHandler handler = new WebSocketStreamHandler(); | ||
PortForwardResult result = new PortForwardResult(handler, ports); | ||
List<Pair> queryParams = new ArrayList<>(); | ||
queryParams.add(new Pair("ports", "80")); |
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.
Is it always '80' or just once for the example you gave above?
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.
ugh! good catch, fixed.
* I/O for first port (80) is on Channel 0 | ||
* Err for first port (80) is on Channel 1 | ||
* I/O for second port (8080) is on Channel 2 | ||
* Err for second port (8080) is on Channel 2 |
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.
Channel 2 or 3?
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.
Good catch, fixed.
* | ||
* @param namespace The namespace of the Pod | ||
* @param name The name of the Pod | ||
* @param ports The ports to forward |
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.
Please add @return
, I don't think our linter is catching it but the release will fail w/o it.
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.
fixed.
* PortForward to a container | ||
* | ||
* @param pod The pod where the port forward is run. | ||
* @param ports The ports to forward |
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.
@return
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.
fixed.
|
||
/** | ||
* Get the API client for these PortForward operations. | ||
* @returns The API client that will be used. |
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.
s/returns/return
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.
fixed.
52c57cd
to
d59e5bb
Compare
@lwander comments addressed, please take another look. Thanks! |
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.
LGTM!
Fixes #11
Uses WebSocket for Port Forward as added by kubernetes/kubernetes#33684
@mbohlool @lwander