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

Don't ask to add a redirect for endpoints with non public exposure #22655

Closed
l0rd opened this issue Nov 3, 2023 · 3 comments · Fixed by che-incubator/che-code#301
Closed
Assignees
Labels
area/editor/vscode Issues related to the Code OSS editor of Che kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system.

Comments

@l0rd
Copy link
Contributor

l0rd commented Nov 3, 2023

Is your enhancement related to a problem? Please describe

Containers endpoints can have an exposure public, internal or none (see the documentation).

If a developer specifies that an endpoint in a devfile has exposure internal or none

components:
  - name: tools
    container:
      image: quay.io/devfile/universal-developer-image:ubi8-latest
      endpoints:
        - exposure: none
          name: debug
          protocol: tcp
          targetPort: 5005

we are still proposing to add a redirect:

image

Describe the solution you'd like

We should not show a prompt for endpoints that have exposure other than public.

@l0rd l0rd added kind/enhancement A feature request - must adhere to the feature request template. area/editor/vscode Issues related to the Code OSS editor of Che severity/P1 Has a major impact to usage or development of the system. labels Nov 3, 2023
@amisevsk amisevsk self-assigned this Nov 13, 2023
@amisevsk
Copy link
Contributor

It looks like there are two mechanisms here:

  1. If a new process starts listening on an in-devfile endpoint, a prompt is shown to the user along the lines of

    Process is now listening on port 3000. Open it ?

  2. If any process starts listening on localhost (i.e. 127.0.0.1) a prompt is shown to the user to either make it remotely available or add a redirect

Testing the two cases above, I'm finding that for case 1) above, everything works as expected, and internal and none endpoints are ignored. In case 2, internal endpoints are still ignored (with the ports plugging logging that it is skipping them), but none endpoints still show the prompt. In this process, I'm also seeing occasional prompts for ports I don't recognize, suggesting it's also detecting internal services when they run. I'll look at fixing the case for localhost + none, but I wonder if the automatic port detection functionality is worth improving as well.

@l0rd
Copy link
Contributor Author

l0rd commented Nov 14, 2023

@amisevsk I don't understand: we ignore processes starts listening on an "in-devfile" endpoint with exposure: none (mechanism n.1)? But in the example I have provided the endpoint is an "in-devfile" and was ignored. And also if the endpoint is not "in-devfile" then how can it be specified as internal or none (mechanisme n.2)? Maybe what you are saying is that mechanism n.1 is for processes listen to any interface other than localhost (e.g. 0.0.0.0) and mechanism n.2 is for processes listening to localhost?

@amisevsk
Copy link
Contributor

amisevsk commented Nov 14, 2023

Sorry, I think I'm just making this more confusing.

All the examples above are in-devfile endpoints -- the difference is whether the process is listening on 0.0.0.0 or localhost. The ports plugin checks multiple different things at once:

  1. If a process starts listening a public endpoint port, prompt the user to open their application
  2. If a process starts listening on localhost instead of 0.0.0.0, warn the user and prompt to redirect the process (using one of the code-redirect endpoints)
  3. If a process starts listening on a port that doesn't match an endpoint, prompt the user to redirect the process

This leads to the following (confusing) table

Listen on 0.0.0.0 Listen on localhost only
endpoint is public (1) (2)
endpoint is internal ignored ignored
endpoint is none ignored (2) (this bug)
endpoint does not exist (3) (2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/vscode Issues related to the Code OSS editor of Che kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants