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

Expose Che server and workspaces through one single TCP port #4269

Closed
wants to merge 1 commit into from

Conversation

l0rd
Copy link
Contributor

@l0rd l0rd commented Feb 28, 2017

What does this PR do?

Add a new ServerEvaluationStrategy: SinglePortLocalDockerServerEvaluationStrategy.

This server strategy can be enabled adding che.docker.server_evaluation_strategy=single-port
in che.properties.

When the single-port strategy is enabled a workspace server address has the format server-ref.workspace-id.che-address like for example:

terminal.79rfwhqaztq2ru2k.che.local

To use the single-port strategy a reverse proxy should be used. This PR comes with the changes needed to use OpenShift embedded reverse-proxy too.

What issues does this PR fix or reference?

#2847 #1560

Changelog

  • Added single-port server evaluation strategy to expose one single TCP port for all Che services

Release Notes

  • Expose Che server and workspace servers through one TCP port adding che.docker.server_evaluation_strategy=single-port
    in che.properties.

Docs PR

How to use single-port strategy with OpenShift embedded reverse proxy will described in the upcoming documentation to run Che with OpenShift.

@l0rd l0rd requested review from garagatyi and amisevsk February 28, 2017 22:13
@l0rd l0rd added the kind/enhancement A feature request - must adhere to the feature request template. label Feb 28, 2017
@codenvy-ci
Copy link

Can one of the admins verify this patch?

@l0rd l0rd added the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Feb 28, 2017
@garagatyi
Copy link

Can you point in issue description relation of this PR to mentioned issues. Some people might think that it fixes both issues whereas it is just related to it.

Please re-phrase changelog to reflect then fact that it works with external reverse proxy (Openshift only or can be another one?).

Can you elaborate on how to access terminals from 2 machines in single workspace with this notation?

@TylerJewell
Copy link

@l0rd - thank you for the contribution!

Let's identify a plan for what we would like to have accomplished before we merge this PR. First, I have added a couple additional maintainers as reviewers for this issue. We'd like to make sure that any changes here are compatible with other custom assemblies, particularly Codenvy as well.

Some items that I'd like to organize for this PR:

  1. A demo review of this implementation with a couple maintainers for a Q&A.
  2. Instructions on how to deploy this configuration with traefik or nginx.
  3. Discuss how to expose configuring this in the che.env file.
  4. Discuss a configuration of the che.env that also launches the reverse proxy.
  5. Updating the docs to reflect these various configurations - particularly port requirements.
  6. Are there any implications to the new diagnostic page in the UD?

@benoitf
Copy link
Contributor

benoitf commented Mar 1, 2017

@TylerJewell
if URL provided by REST API are in the format "terminal.79rfwhqaztq2ru2k.che.local" that is not directly reachable yes that would be an issue for diagnostic tool that connect directly to the URLs provided by server side.

@l0rd
Copy link
Contributor Author

l0rd commented Mar 1, 2017

@TylerJewell please note that this single port strategy is enabled only if property che.docker.server_evaluation_strategy is set to singel-port. And by default it is not.

In other words this PR, as the rest of the OpenShift connector related PR, should not break anything and can be merged safely. And even if I agree with all your points this PR should not be blocked by these. We can merge it now (that will help us and won't break anything) and still continue improving it together via other PRs in the next weeks.

@benoitf
Copy link
Contributor

benoitf commented Mar 1, 2017

for me the wording "single-port" is not obvious as it requires extra front-end tools to use that. It could be seen by end users as a property that can be used directly while it won't work directly.

@TylerJewell
Copy link

@l0rd - while the initiation of this was for openshift, it's a core evaluation strategy, so will only want to merge this into the system until we have provided for enhancements to the various utilities that will be affected by it - including diagnostic utility, CLI, configuration and docs. Otherwise, if we have a policy that we'll commit the core and then delay the other PRs, there is a chance that the other PRs are never completed.


return getExposedPortsToAddressPorts(externalAddress, containerInfo.getNetworkSettings().getPorts());
protected String getCheExternalAddress(ContainerInfo containerInfo, String internalHost) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is external address of container in WS, not Che itself. Previous name of variable with this value was more precise.

* Represents a server evaluation strategy for the configuration where the workspace server and workspace
* containers are running on the same Docker network and are exposed through the same single port.
*
* This server evaluation strategy will return a completed {@link ServerImpl} with internal addresses set

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on what completed {@link ServerImpl} means? I don't really understand, so probably I'm missing something.

* This server evaluation strategy will return a completed {@link ServerImpl} with internal addresses set
* as {@link LocalDockerServerEvaluationStrategy} does. Contrarily external addresses will have the following format:
*
* serverName.workspaceID.cheExternalAddress (e.g. terminal.79rfwhqaztq2ru2k.che.local)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said in comment to the PR it's not clear how workspaces with multiple machines will work.

@@ -61,10 +61,13 @@
* @param internalAddress
* address passed into {@code getServers}; used as fallback if address cannot be
* retrieved from containerInfo.
* @param serverConfMap
* additional Map of {@link ServerConfImpl}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unclear from javadocs why this additional map is needed. Please explain it in javadocs.

Copy link
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree more than 100% on the final goal, I find the implementation of the strategy too specific for a given product.
Let's say we use a different reverse proxy, we would need another pattern, etc

Could it be possible to name it instead of "single-port" something more generic ?

and instead of always using pattern
ref.workspace-id.che-address

to allow to pickup the pattern through a list of predefined properties
like in your case it could be
".."

but we could have
<che.protocol>://:/-

or any pattern built upon a set of properties

@l0rd
Copy link
Contributor Author

l0rd commented Mar 8, 2017

@garagatyi @benoitf @TylerJewell thanks for your review. I've opened a second PR (#4351) to merge that work in the openshift-connector branch as it is to get it tested/run by our CI. In the meantime I will push more commits on this PR to address your comments and to get that merged to master too.

@TylerJewell
Copy link

I am going to invite Florent to help us explore how we can get it ready for a master merge. It is a challenging exercise but one we have in our objectives for the year.

@benoitf
Copy link
Contributor

benoitf commented Jun 14, 2017

I think we can close this PR
(overlap with #5115 and #5366 + #5052 )

@l0rd
Copy link
Contributor Author

l0rd commented Jun 14, 2017

We have merged that on openshift connector branch a long time ago.

@l0rd l0rd closed this Jun 14, 2017
@l0rd l0rd deleted the single-port branch June 14, 2017 13:31
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants