Skip to content

Commit

Permalink
CHE-5908 Add warning when ingress annotations are absent in configura…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
sleshchenko committed Feb 7, 2018
1 parent 393711c commit 0f764c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ che.infra.kubernetes.pvc.access_mode=ReadWriteOnce
# then OpenShift infrastructure will reconfigure installer to use first available from this range
che.infra.kubernetes.installer_server_min_port=10000
che.infra.kubernetes.installer_server_max_port=20000

# Defines annotations for ingresses which are used for servers exposing. Value depends on ingress controller.
# For example for nginx ingress controller 0.9.0-beta17 the following value is recommended:
# {"ingress.kubernetes.io/rewrite-target": "/","ingress.kubernetes.io/ssl-redirect": "false",\
# "ingress.kubernetes.io/proxy-connect-timeout": "3600","ingress.kubernetes.io/proxy-read-timeout": "3600"}
#
# OpenShift infrastructure ignores this property because it uses Routes instead of ingresses.
che.infra.kubernetes.ingress.annotations_json=NULL

# Defines security context for pods that will be created by Kubernetes Infra
Expand All @@ -402,6 +409,7 @@ che.infra.kubernetes.ingress.annotations_json=NULL
che.infra.kubernetes.pod.security_context.run_as_user=NULL
che.infra.kubernetes.pod.security_context.fs_group=NULL


### OpenShift Infra parameters
#
# Since OpenShift infrastructure reuse Kubernetes infrastructure components
Expand Down
8 changes: 8 additions & 0 deletions dockerfiles/init/manifests/che.env
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,14 @@ CHE_SINGLE_PORT=false
# https://docs.kubernetes.com/container-platform/latest/architecture/additional_concepts/storage.html#pv-access-modes
#CHE_INFRA_KUBERNETES_PVC_ACCESS__MODE=ReadWriteOnce

# Defines annotations for ingresses which are used for servers exposing. Value depends on ingress controller.
# For example for nginx ingress controller 0.9.0-beta17 the following value is recommended:
# {"ingress.kubernetes.io/rewrite-target": "/","ingress.kubernetes.io/ssl-redirect": "false",\
# "ingress.kubernetes.io/proxy-connect-timeout": "3600","ingress.kubernetes.io/proxy-read-timeout": "3600"}
#
# OpenShift infrastructure ignores this property because it uses Routes instead of ingresses.
#CHE_INFRA_KUBERNETES_INGRESS_ANNOTATIONS__JSON=NULL

########################################################################################
##### #####
##### Openshift Infrastructure #####
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/init/modules/kubernetes/Deploy Che.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ not to break websocket connections.
In particular testing environment was setup with NginX ingress controller 0.9.0-beta.17.
So we added annotations specific to this implementation and version:
- ingress.kubernetes.io/rewrite-target: /
- ingress.kubernetes.io/ssl-redirect": "false"
- ingress.kubernetes.io/proxy-read-timeout: "3600"
- ingress.kubernetes.io/proxy-connect-timeout: "3600"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import org.eclipse.che.workspace.infrastructure.kubernetes.Constants;
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment;
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.UniqueNamesProvisioner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Helps to modify {@link KubernetesEnvironment} to make servers that are configured by {@link
Expand Down Expand Up @@ -123,6 +125,8 @@
*/
public class KubernetesServerExposer<T extends KubernetesEnvironment> {

private static final Logger LOG = LoggerFactory.getLogger(KubernetesServerExposer.class);

public static final int SERVER_UNIQUE_PART_SIZE = 8;
public static final String SERVER_PREFIX = "server";

Expand All @@ -138,6 +142,11 @@ public KubernetesServerExposer(
Pod pod,
Container container,
T kubernetesEnvironment) {
if (ingressAnnotations == null) {
LOG.warn(
"Ingresses annotations are absent. Make sure that workspace ingresses don't need "
+ "to be configured according to ingress controller.");
}
this.ingressAnnotations = ingressAnnotations;
this.machineName = machineName;
this.pod = pod;
Expand Down

0 comments on commit 0f764c5

Please sign in to comment.