Skip to content

Commit

Permalink
fixes #17064 - gateway single-host with helm (#17788)
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkoo authored Sep 10, 2020
1 parent 098bf02 commit 0bddb7a
Show file tree
Hide file tree
Showing 21 changed files with 401 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# SPDX-License-Identifier: EPL-2.0
#

{{- if not (and (eq .Values.global.serverStrategy "single-host") (eq .Values.global.singleHostExposure "gateway")) }}

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand Down Expand Up @@ -49,3 +51,5 @@ spec:
- {{ template "devfileRegistryHost" . }}
secretName: {{ .Values.global.tls.secretName }}
{{- end -}}

{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

{{- if and (eq .Values.global.serverStrategy "single-host") (eq .Values.global.singleHostExposure "gateway") }}

apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: che
component: che-gateway-config
name: che-gateway-route-devfile-registry
data:
devfile-registry.yml: |
http:
routers:
devfile-registry:
rule: "PathPrefix(`/devfile-registry`)"
service: devfile-registry
middlewares: [devfile-registry]
priority: 10
services:
devfile-registry:
loadBalancer:
servers:
- url: 'http://devfile-registry:8080'
middlewares:
devfile-registry:
stripPrefix:
prefixes:
- '/devfile-registry'
{{- end }}
12 changes: 12 additions & 0 deletions deploy/kubernetes/helm/che/custom-charts/che-gateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: "v1"
name: "che-gateway"
version: "0.0.1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: che
component: che-gateway
name: che-gateway-config
data:
traefik.yml: |
global:
checkNewVersion: false
sendAnonymousUsage: false
entrypoints:
http:
address: ":8080"
forwardedHeaders:
insecure: true
https:
address: ":8443"
forwardedHeaders:
insecure: true
providers:
file:
directory: "/dynamic-config"
watch: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# Copyright (c) 2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: che
component: che-gateway
name: che-gateway
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: che
component: che-gateway
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
template:
metadata:
labels:
app: che
component: che-gateway
spec:
serviceAccountName: che-gateway
containers:
- name: gateway
image: {{ .Values.cheGateway.gatewayImage }}
imagePullPolicy: {{ .Values.cheGateway.imagePullPolicy }}
volumeMounts:
- name: static-config
mountPath: /etc/traefik
- name: dynamic-config
mountPath: "/dynamic-config"
- name: configbump
image: {{ .Values.cheGateway.configBumpImage }}
imagePullPolicy: {{ .Values.cheGateway.imagePullPolicy }}
env:
- name: CONFIG_BUMP_DIR
value: "/dynamic-config"
- name: CONFIG_BUMP_LABELS
value: {{ .Values.global.singleHostGatewayLabels | quote }}
- name: CONFIG_BUMP_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: dynamic-config
mountPath: "/dynamic-config"
volumes:
- name: static-config
configMap:
name: che-gateway-config
- name: dynamic-config
emptyDir: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: che-gateway
rules:
- verbs:
- watch
- get
- list
apiGroups:
- ""
resources:
- configmaps
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: che-gateway
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: che-gateway
subjects:
- kind: ServiceAccount
name: che-gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: v1
kind: Service
metadata:
labels:
app: che
component: che-gateway
name: che-gateway
spec:
ports:
- protocol: TCP
port: 8080
targetPort: 8080
selector:
app: che
component: che-gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: che
component: che-gateway
name: che-gateway
13 changes: 13 additions & 0 deletions deploy/kubernetes/helm/che/custom-charts/che-gateway/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

cheGateway:
gatewayImage: docker.io/traefik:v2.2.8
configBumpImage: quay.io/che-incubator/configbump:0.1.4
imagePullPolicy: Always
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# SPDX-License-Identifier: EPL-2.0
#

{{- if not (and (eq .Values.global.serverStrategy "single-host") (eq .Values.global.singleHostExposure "gateway")) }}

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand Down Expand Up @@ -46,3 +48,5 @@ spec:
backend:
serviceName: keycloak
servicePort: 5050

{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

{{- if and (eq .Values.global.serverStrategy "single-host") (eq .Values.global.singleHostExposure "gateway") }}

apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: che
component: che-gateway-config
name: che-gateway-route-keycloak
data:
keycloak.yml: |
http:
routers:
keycloak:
rule: "PathPrefix(`/auth`)"
service: keycloak
priority: 10
services:
keycloak:
loadBalancer:
servers:
- url: 'http://keycloak:5050'
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# SPDX-License-Identifier: EPL-2.0
#

{{- if not (and (eq .Values.global.serverStrategy "single-host") (eq .Values.global.singleHostExposure "gateway")) }}

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand Down Expand Up @@ -49,3 +51,5 @@ spec:
- {{ template "pluginRegistryHost" . }}
secretName: {{ .Values.global.tls.secretName }}
{{- end -}}

{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

{{- if and (eq .Values.global.serverStrategy "single-host") (eq .Values.global.singleHostExposure "gateway") }}

apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: che
component: che-gateway-config
name: che-gateway-route-plugin-registry
data:
plugin-registry.yml: |
http:
routers:
plugin-registry:
rule: "PathPrefix(`/plugin-registry`)"
service: plugin-registry
middlewares: [plugin-registry]
priority: 10
services:
plugin-registry:
loadBalancer:
servers:
- url: 'http://plugin-registry:8080'
middlewares:
plugin-registry:
stripPrefix:
prefixes:
- '/plugin-registry'
{{- end }}
4 changes: 4 additions & 0 deletions deploy/kubernetes/helm/che/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#

dependencies:
- name: che-gateway
repository: file://./custom-charts/che-gateway/
version: 0.0.1
condition: cheSinglehostGateway.deploy
- name: che-devfile-registry
repository: file://./custom-charts/che-devfile-registry/
version: 0.0.1
Expand Down
2 changes: 2 additions & 0 deletions deploy/kubernetes/helm/che/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ data:
{{- end }}
CHE_INFRA_KUBERNETES_INGRESS_PATH__TRANSFORM: '%s(.*)'
CHE_INFRA_KUBERNETES_SERVER__STRATEGY: {{ .Values.global.serverStrategy }}
CHE_INFRA_KUBERNETES_SINGLEHOST_WORKSPACE_EXPOSURE: {{ .Values.global.singleHostExposure | quote }}
CHE_INFRA_KUBERNETES_SINGLEHOST_GATEWAY_CONFIGMAP__LABELS: {{ .Values.global.singleHostGatewayLabels | quote }}
CHE_LOGGER_CONFIG: {{ .Values.global.log.loggerConfig | quote}}
CHE_LOGS_APPENDERS_IMPL: {{ .Values.global.log.appenderName }}
CHE_WORKSPACE_HTTP__PROXY: {{ .Values.cheWorkspaceHttpProxy | quote}}
Expand Down
Loading

0 comments on commit 0bddb7a

Please sign in to comment.