-
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
Adds support of named ports for kubectl port-forward #69477
Adds support of named ports for kubectl port-forward #69477
Conversation
pkg/kubectl/cmd/portforward.go
Outdated
return parts[0], parts[1] | ||
} | ||
|
||
return parts[0], parts[0] |
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.
nit: just return "" for the second value here
I see, missed the use-case for returning the same value here in the changes below
Rebased |
/ok-to-test |
/retest |
if err != nil { | ||
containerPort, err := util.LookupContainerPortNumberByName(pod, remotePort) | ||
if err != nil { | ||
return ports, err |
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.
nit, just return nil, err
here
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.
Thanks, updated.
@m1kola please squash into single commit |
@juanvallejo please, re-approve. I rebased and squashed. Sorry for this. I tried to split PR into multiple smaller PRs for easier review. |
/lgtm |
/retest |
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: m1kola, soltysh 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:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Adds support of named ports for
kubectl port-forward
, so users will be able to run commands like this:Same will work with services (including translation of the service's port into the pod's port).
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes kubernetes/kubectl#538
Special notes for your reviewer:
Please, note that this PR also includes #69403 which needs to be reviewed and merged first (it makes an util function to be exportable, so we can use it in the port-forward command).
Release note:
/sig cli
/kind feature