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

Allow users define custom port-mappings for port forwarding #6479

Closed
7 of 8 tasks
kadel opened this issue Jan 9, 2023 · 5 comments · Fixed by #6766
Closed
7 of 8 tasks

Allow users define custom port-mappings for port forwarding #6479

kadel opened this issue Jan 9, 2023 · 5 comments · Fixed by #6766
Assignees
Labels
kind/user-story An issue of user-story kind pair programming Issue that is a good candidate for pair programming priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). priority/Medium Nice to have issue. Getting it done before priority changes would be great. sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint.
Milestone

Comments

@kadel
Copy link
Member

kadel commented Jan 9, 2023

/kind user-story

User Story

As an odo user, I want to be able to define a mapping for port-forwarding So that I can have predictable port numbers; this is useful when developing multi-component applications.

example:

cd frontend
odo dev

cd ../backend
odo dev

configure the frontend to use port 20002 (odo dev for backed was started second)

I stop everything, next day I want to continue working but this time I start odo dev session for backend before frontend. Now I have to keep in mind to reconfigure the frontend to use a different port.

A slightly better experience would be to have

cd frontend
odo dev

cd ../backend
odo dev --port-forward 8888:8000

Now no matter what order I run commands, I will get backed on localhost:8888.

An even better experience would be for odo to remember custom port mappings so next time I can just do odo dev. This is something that we can look into as second stage.

Acceptance Criteria

  • Users should be able to define custom port mapping using flags provided to odo dev command using --port-forward flag. Flag accepts argument in <localPort>:<containerPort>
  • port-forward can be defined as multiple times (for multiple ports)
  • if multiple containers have the same port and the command should fail and guide the user to specify container name --port-forward <localPort>:<containerName>:<containerPort>
  • --address <ipaddress> flag should allow specifying on which local address the port will be listening
  • Validate if the containerPort is a valid endpoint(?)
  • Handle dedicatedPod (is it handled currently?) (not handled in the Devfile library: Support dedicatedPod field on container components #6786)
  • Cannot use --random-port and --port-forward together.
  • Validate that a local port is not defined more than once

allowed formats for --port-forward

8080:80 - local port 8080 listening only on localhost, container port 80
8080:mycontainer:80 - local port 8080 listening only on localhost, container port 80 on container called mycontainer

/kind user-story

@openshift-ci openshift-ci bot added the kind/user-story An issue of user-story kind label Jan 9, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Jan 9, 2023
@rm3l rm3l added this to odo Project Jan 9, 2023
@kadel kadel added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Jan 10, 2023
@kadel kadel added priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). and removed needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. labels Mar 8, 2023
@rm3l
Copy link
Member

rm3l commented Mar 22, 2023

Grooming (2023-03-23)

  • Separate flag for listening host

@valaparthvi valaparthvi added the sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint. label Mar 22, 2023
@rm3l rm3l added this to the v3.9.0 🚀 milestone Mar 23, 2023
@rm3l rm3l moved this to In Progress 🚧 in odo Project Mar 28, 2023
@rm3l rm3l added the pair programming Issue that is a good candidate for pair programming label Mar 29, 2023
@valaparthvi
Copy link
Contributor

valaparthvi commented Mar 29, 2023

Can user also provide <hostip>:<localPort>:<containerName>:<containerPort>?

Should we allow :<containerPort>? Technically it is still valid, and a random port would be assigned, so I think it should be accepted.

We do not accept it atm, if there is a user requirement to do so, we can change it later. [Grooming Call March 30 '23]

@valaparthvi
Copy link
Contributor

valaparthvi commented Apr 3, 2023

This issue will be fixed in 3 parts to avoid larger PR size:

@valaparthvi
Copy link
Contributor

What port range should we accept? Currently it accepts any value between 1 to 65535. Should we increase the lower limit to 1024?

@rm3l rm3l modified the milestones: v3.9.0 🚀, v3.10.0 🚀 Apr 5, 2023
@rm3l
Copy link
Member

rm3l commented Apr 6, 2023

What port range should we accept? Currently it accepts any value between 1 to 65535. Should we increase the lower limit to 1024?

I think we should not prevent that.
A user might want to run odo dev as root to expose an application via a privileged port.. And it is even possible to grant a binary like odo the system capability to open privileged ports while still running with the privileges of a regular user.
I think we should make sure an appropriate error is returned when setting up port forwarding if the user does not have permission open privileged ports.

@valaparthvi valaparthvi moved this from In Progress 🚧 to In Review 👀 in odo Project Apr 13, 2023
@valaparthvi valaparthvi moved this from In Review 👀 to In Progress 🚧 in odo Project Apr 13, 2023
@valaparthvi valaparthvi moved this from In Progress 🚧 to In Review 👀 in odo Project Apr 18, 2023
@valaparthvi valaparthvi moved this from In Review 👀 to To Do 📝 in odo Project Apr 18, 2023
@valaparthvi valaparthvi moved this from To Do 📝 to In Progress 🚧 in odo Project Apr 23, 2023
@valaparthvi valaparthvi moved this from In Progress 🚧 to In Review 👀 in odo Project Apr 26, 2023
@github-project-automation github-project-automation bot moved this from In Review 👀 to Done ✅ in odo Project May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/user-story An issue of user-story kind pair programming Issue that is a good candidate for pair programming priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). priority/Medium Nice to have issue. Getting it done before priority changes would be great. sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants