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

k8s-infra: routing, TLS (rebased) #9329

Merged
merged 6 commits into from
Apr 10, 2018
Merged

k8s-infra: routing, TLS (rebased) #9329

merged 6 commits into from
Apr 10, 2018

Conversation

guydc
Copy link
Contributor

@guydc guydc commented Apr 4, 2018

Signed-off-by: Guy Daich guy.daich@sap.com

What does this PR do?

Replaces stale PR: #8822 . All previous commits are squashed.

Introduce an External Server Exposer Strategy, responsible for exposing service ports associated with external servers, making them accessible from outside the cluster.

Move server exposure to shared k8s infra level:

  • Extract Openshift External Server Exposer to dedicated class.
  • Consolidate Openshift Server Exposer and Server converter with Kubernetes Infra.

Provide three options for exposing external (and secondary) servers in k8s infra:

  • multi-host: unique hostname for each component, like Che Openshift infrastructure.
  • single-host: single hostname for all components. Can be used in conjunction with TLS.
  • default-host: default ingress hostname. Can be used for local development without dynamic DNS (based on ingress IP).

Add basic TLS support:

  • Integrate with cert-manager in single-host configuration, to issue a LetsEncrypt certificate. Use cluster-wide issuers and ingress-shim annotations.
    Add Ingress TLS provisioning.
  • Move TLS_ENABLED configuration to Kubernetes Infra Level.

Update Docs:

  • Add example value files for more convenient helm deployment of multi-user, default-host and TLS configurations.
  • Update readme deployment instructions.
  • update readme minikube setup (add RBAC)

Multiuser:

  • Che waits for Keycloak as well as postgres in helm deployment.
  • Keycloak uses a service account to poll postgres endpoint availability.

Test PR

Follow instructions to set up minikube, helm, tiller, cert-manager.

Follow specific instructions for single/multi-user, default-host installation on minikube.

Routing strategies tested locally on minikube & minishift.

What issues does this PR fix or reference?

This PR fixes #8694.
This PR is part of kubernetes infrastructure epic #5908.

Release Notes

Docs PR

Currently, documented only in the Che Kubernetes Helm deployment instructions.

guydc added 3 commits April 4, 2018 15:06
Signed-off-by: Guy Daich <guy.daich@sap.com>

Adapt OS infra to use external server exposer

Signed-off-by: Guy Daich <guy.daich@sap.com>

reuse k8s ServersConverter in OS infra

begin tls for path-based k8s infra

Signed-off-by: Guy Daich <guy.daich@sap.com>

continue k8s tls support

Signed-off-by: Guy Daich <guy.daich@sap.com>

Add single-host strategy, cert-manager support

Signed-off-by: Guy Daich <guy.daich@sap.com>

fix charts, add single-host strategy, add TLS test

Signed-off-by: Guy Daich <guy.daich@sap.com>

TLS: changed cert-manager certficiate issuer to be ClusterIssuer

Signed-off-by: Eyal Barlev <perspectivus@gmail.com>

add resolved values.yaml

Signed-off-by: Guy Daich <guy.daich@sap.com>

Adapt to k8s Multiuser

* Add sample values files
* Fix merge issues

Signed-off-by: Guy Daich <guy.daich@sap.com>

Cleanup OpenShift Infra

* rename TLS default value in che.env
* remove openshift server exposer (consolidated with k8s)

Signed-off-by: Guy Daich <guy.daich@sap.com>

remove uintended automation changes

Signed-off-by: Guy Daich <guy.daich@sap.com>

cloud deployment helm changes

Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: Guy Daich <guy.daich@sap.com>
@guydc guydc requested a review from benoitf as a code owner April 4, 2018 13:29
@guydc guydc requested a review from a user April 4, 2018 13:29
@benoitf benoitf added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. kind/enhancement A feature request - must adhere to the feature request template. kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. labels Apr 4, 2018
@codenvy-ci
Copy link

Can one of the admins verify this patch?

2 similar comments
@codenvy-ci
Copy link

Can one of the admins verify this patch?

@codenvy-ci
Copy link

Can one of the admins verify this patch?

@ghost
Copy link

ghost commented Apr 5, 2018

I have tested the PR and can confirm #8694 is fixed. No more wrong redirects. Thanks @guydaichs

@guydc
Copy link
Contributor Author

guydc commented Apr 5, 2018

@eivantsov multi-host should work. it's on by default.

Copy link
Contributor

@l0rd l0rd left a comment

Choose a reason for hiding this comment

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

Thanks @guydaichs

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

Well done. Looks GOOD to me 👍

Please take a look my minor comments

CHE_INFRA_KUBERNETES_SERVER__STRATEGY: {{ .Values.global.serverStrategy }}



Copy link
Member

Choose a reason for hiding this comment

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

Please remove extra lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

che.infra.openshift.tls_enabled=false
# Creates Ingresses with Transport Layer Security (TLS) enabled
# In OpenShift infrastructure, Routes will be TLS-enabled
che.infra.kubernetes.tls_enabled=false
Copy link
Member

Choose a reason for hiding this comment

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

Please move new Kubernetes properties above to Kubernetes section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

che.infra.kubernetes.tls_enabled=false

# Name of a secret that should be used when creating workspace ingresses with TLS
che.infra.kubernetes.tls_secret=
Copy link
Member

Choose a reason for hiding this comment

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

Please add a note that it is ignored by OpenShift infrastructure, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct. done.

@@ -506,6 +507,10 @@ CHE_SINGLE_PORT=false
# OpenShift infrastructure ignores this property because it uses Routes instead of ingresses.
#CHE_INFRA_KUBERNETES_INGRESS_ANNOTATIONS__JSON=NULL

# Creates Ingresses with Transport Layer Security (TLS) enabled
# In OpenShift infrastructure, Routes will be TLS-enabled
CHE_INFRA_KUBERNETES_TLS_ENABLED=false
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it makes sense to add CHE_INFRA_KUBERNETES_TLS__SECRET here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if (externalServerExposerStrategy != null) {
this.externalServerExposerStrategy = externalServerExposerStrategy;
} else {
throw new IllegalArgumentException(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be better to throw org.eclipse.che.inject.ConfigurationException here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

guydc added 3 commits April 6, 2018 14:41
Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: Guy Daich <guy.daich@sap.com>
@slemeur slemeur removed the kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. label Apr 6, 2018
@garagatyi
Copy link

@guydaichs
Git is complicated stuff but, please, do not recreate PRs unless you really have to because reviewers have to review the whole PR all over again after that. The same stuff about force pushing to the PR branch. We can always squash everything on the merge. Or you can wait until all the reviews are in place and the squash or rebase the PR.

@garagatyi garagatyi merged commit a48d4b4 into eclipse-che:master Apr 10, 2018
@garagatyi
Copy link

@guydaichs cool contribution to the project! Congrats!

@benoitf benoitf added this to the 6.4.0 milestone Apr 10, 2018
@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 Apr 10, 2018
dmytro-ndp pushed a commit that referenced this pull request Apr 11, 2018
Introduce an External Server Exposer Strategy, 
responsible for exposing service ports associated with external servers,
making them accessible from outside the cluster.
Move server exposure to shared k8s infra level:
- multi-host: unique hostname for each component, like Che Openshift infrastructure.
- single-host: single hostname for all components. Can be used in conjunction with TLS.
- default-host: default ingress hostname. Can be used for local development without dynamic DNS (based on ingress IP).
Add basic TLS support.
Signed-off-by: Guy Daich <guy.daich@sap.com>
@@ -1,7 +1,9 @@
{{- define "cheHost" }}
{{- if .Values.global.isHostBased }}
{{- printf "master.%s" .Values.global.cheDomain }}
{{- if eq .Values.global.serverStrategy "default-host" }}
Copy link
Member

Choose a reason for hiding this comment

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

@guydaichs Looks like after your changes readme.md is outdated. I mean the following line

If you must use an ip address (e.g. your corporate policy prevents you from using nip.io), you would also have to set isHostBased to false.

Could you please review readme.md and update information about servers strategies there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

👍 Thanks

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.

Add an ability to use host-based routing instead of path-based for k8s infra
9 participants