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

On the go workspace config: detect if a service that is listening to a port and propose to expose it #12061

Closed
2 tasks
ibuziuk opened this issue Nov 27, 2018 · 17 comments
Assignees
Labels
kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed.

Comments

@ibuziuk
Copy link
Member

ibuziuk commented Nov 27, 2018

Description

  • Detect process that is listening to some port
  • Once process is detected and port is identified there should be an proposal from IDE to expose service + route for this process automatically.
@ibuziuk
Copy link
Member Author

ibuziuk commented Nov 27, 2018

@slemeur @l0rd could you please provide more details?

@ibuziuk ibuziuk added the Epic label Nov 27, 2018
@garagatyi
Copy link

I discussed this topic with Florent and did some investigations.
To get a list of listened ports we can call: cat /proc/net/tcp | grep " 0A " | awk '{print $2}' | cut -d: -f2 | xargs -I %% printf "%d\n" 0x%%. We can also do this with a simple binary to avoid depending on used linux commands.
While this works fine for a single container option it doesn't for a multi-container and multi-pod approach.
K8s allows sharing net namespace (docs) so we would be able to use a tiny sidecar in every pod, but this didn't work on openshift for me. Any ideas why?
We can also think about other techiques such as mounting binary of such a tool as secret to every container and then call it using the exec from another sidecar, but this is mess. Would be better avoiding it.

@slemeur slemeur mentioned this issue Dec 11, 2018
69 tasks
@skabashnyuk skabashnyuk added kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. and removed Epic labels Dec 14, 2018
@garagatyi
Copy link

According to this article we can expose a port without declaring it in a pod.
[x] We know how to find if a port is being listened with a command from comments above.
[x] We know how to create service/ingress/route to expose it on a running workspace.
[ ] We need to figure out how to deliver a binary of a tool that can do what that command does (config map, sidecar, etc)
[ ] We need to provide a REST API on Che master to open a port in a workspace
[ ] We need to create something that would periodically call exec sidecar to check if new ports are being listened and call Che master API to open a new port

In this case, a user starts an application and after some time we automatically detect this and open a port and can show a notification about it.
To improve this we could add a menu item to theia called Ports which:

  • would have Open port item
  • add a command to open a port to command palette

We can start from a simple approach:

  • add default plugin that adds the above-mentioned menu to Theia
  • Che master API to open a new port in a workspace

@l0rd
Copy link
Contributor

l0rd commented Jan 31, 2019

@garagatyi 👍

@l0rd
Copy link
Contributor

l0rd commented Jan 31, 2019

We need to figure out how to deliver a binary of a tool that can do what that command does (config map, sidecar, etc)

Can't we use a theia plugin to watch for processes listening to ports (instead of having a separate binary)?

We need to provide a REST API on Che master to open a port in a workspace

I believe that you want the call to happen Che server side because a process running in the theia container doesn't have enough privileges to create a route but can't we use a service account that has those privileges as we do for the terminal plugin (or use the same service account)?

I am totally ok with the approach otherwise!

@garagatyi
Copy link

@l0rd it is what I'm suggesting in the simple approach section

We can start from a simple approach:

add default plugin that adds the above-mentioned menu to Theia
Che master API to open a new port in a workspace

  1. use Theia plugin and package it as default plugin in Che Theia
    2.1. Provide API from master
    OR
    2.2. Implement Service, Ingress/Route creation in a plugin. I like this idea since we don't have to make Che master more complex. But there are security constraints like we have on OSIO. I do think that we can allow this on OSIO. But it seems that SAP guys are even more strict with the permissions to K8s API. We might consider using approach that we would be able to use in their case.

@benoitf
Copy link
Contributor

benoitf commented Feb 5, 2019

UX could be this one: eclipse-che/che-theia#51 :-)

@garagatyi
Copy link

It is an interesting solution that doesn't have issues that 2 suggested ones have. So +1

@ibuziuk
Copy link
Member Author

ibuziuk commented Feb 6, 2019

@benoitf this UX looks really great ;-) Are you planning to take care of this issue ?

@benoitf
Copy link
Contributor

benoitf commented Feb 8, 2019

@ibuziuk yes I think it will be addressed with eclipse-che/che-theia#51

@benoitf benoitf self-assigned this Feb 8, 2019
@l0rd l0rd mentioned this issue Feb 19, 2019
@slemeur
Copy link
Contributor

slemeur commented Mar 12, 2019

Fixed by: eclipse-che/che-theia#51

@slemeur slemeur closed this as completed Mar 12, 2019
@l0rd
Copy link
Contributor

l0rd commented Mar 19, 2019

@benoitf what steps should a user take to make this work? I mean I have tried with spring boot application and it didn't work: when I started the application I wasn't asked to expose the port. Is there something to configure?

@benoitf
Copy link
Contributor

benoitf commented Mar 20, 2019

@l0rd I will work on it (basically it doesn't work because the plug-in is not enabled by default ;-)

@l0rd
Copy link
Contributor

l0rd commented Mar 20, 2019

Ok thanks @benoitf

benoitf added a commit to eclipse-che/che-theia that referenced this issue Mar 26, 2019
eclipse-che/che#12061

Change-Id: I6a0087eba9e5b39ab866bcdf095489552f974bfd
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
benoitf added a commit to eclipse-che/che-theia that referenced this issue Mar 26, 2019
eclipse-che/che#12061

Change-Id: I6a0087eba9e5b39ab866bcdf095489552f974bfd
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
benoitf added a commit to eclipse-che/che-theia that referenced this issue Mar 26, 2019
eclipse-che/che#12061

Change-Id: I6a0087eba9e5b39ab866bcdf095489552f974bfd
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
benoitf added a commit to eclipse-che/che-theia that referenced this issue Mar 26, 2019
eclipse-che/che#12061

Change-Id: I6a0087eba9e5b39ab866bcdf095489552f974bfd
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
@benoitf
Copy link
Contributor

benoitf commented Mar 27, 2019

@l0rd done, it is now added by default

@garagatyi
Copy link

@benoitf cool!
@l0rd can we close this issue?

@l0rd
Copy link
Contributor

l0rd commented Apr 19, 2019

Yes it's working fine currently so let's close it

@l0rd l0rd closed this as completed Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed.
Projects
None yet
Development

No branches or pull requests

6 participants