Skip to content

Commit

Permalink
CHE-5908: add config to deploy Che on k8s
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Garagatyi <ogaragat@redhat.com>
  • Loading branch information
Oleksandr Garagatyi committed Feb 1, 2018
1 parent 1266842 commit 9de2754
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 137 deletions.
18 changes: 18 additions & 0 deletions dockerfiles/init/modules/kubernetes/Deploy Che.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Deploy single user Che to k8s
Tested on minikube with vm provider Virtualbox. Note that Che with workspaces requires quite a lot
of RAM. Initial tests were done with 10GB, but it is definitely more than it is needed to start Che
and couple of workspaces.
IP of VM is supposed to be `192.168.99.100`. `nip.io` is also used for handling hosts resolution.
If you have another IP or DNS replace these values in k8s.yml file.

###Prerequisites:
- Ingress controller is running. Note: you can start it on minikube with `minikube addons enable ingress`.
- Currently Che workspaces work with NginX ingress controller only. Note: it is default ingress controller on minikube.
- DNS discovery should be enabled. Note: enabled by default in minikube.
### Deployment process:
Note: despite the fact that it is not necessary to use a separate namespace for Che
we use it to simplify development operations such as cleaning of spoiled environment
and clean redeploy of Che.
- Create namespace `che`: `kubectl create namespace che`
- Deploy Che: `kubectl --namespace=che apply -f k8s.yml`
- Check Che pod status until it become `Running`: `kubectl get --namespace=che pods`
222 changes: 85 additions & 137 deletions dockerfiles/init/modules/kubernetes/files/che-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,58 +34,52 @@ items:
resources:
requests:
storage: 1Gi
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: che
name: claim-che-workspace
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: che
name: che
data:
CHE_MULTIUSER: "false"
CHE_INFRASTRUCTURE_ACTIVE: openshift
CHE_INFRA_OPENSHIFT_MASTER__URL: ""
CHE_INFRA_OPENSHIFT_USERNAME: ""
CHE_INFRA_OPENSHIFT_PASSWORD: ""
CHE_INFRA_OPENSHIFT_OAUTH__TOKEN: ""
CHE_INFRA_OPENSHIFT_TRUST__CERTS: "false"
CHE_INFRA_OPENSHIFT_TLS__ENABLED: "false"
CHE_INFRA_OPENSHIFT_PVC_STRATEGY: "common"
CHE_INFRA_OPENSHIFT_PROJECT: ""
CHE_INFRA_OPENSHIFT_MACHINE__START__TIMEOUT__MIN: "5"
CHE_INFRA_OPENSHIFT_BOOTSTRAPPER_BINARY__URL: http://192.168.99.100/agent-binaries/linux_amd64/bootstrapper/bootstrapper
CHE_API: http://192.168.99.100/api
CHE_HOST: 192.168.99.100
CHE_WEBSOCKET_ENDPOINT: ws://192.168.99.100/api/websocket
CHE_HOST: "192.168.99.100.nip.io"
CHE_PORT: "8080"
CHE_API: "http://192.168.99.100.nip.io/api"
CHE_WEBSOCKET_ENDPOINT: ws://192.168.99.100.nip.io/api/websocket
CHE_DEBUG_SERVER: "true"
CHE_INFRASTRUCTURE_ACTIVE: kubernetes
CHE_INFRA_KUBERNETES_BOOTSTRAPPER_BINARY__URL: http://192.168.99.100.nip.io/agent-binaries/linux_amd64/bootstrapper/bootstrapper
CHE_INFRA_KUBERNETES_MACHINE__START__TIMEOUT__MIN: "5"
CHE_INFRA_KUBERNETES_MASTER__URL: ""
CHE_INFRA_KUBERNETES_OAUTH__TOKEN: ""
CHE_INFRA_KUBERNETES_PASSWORD: ""
CHE_INFRA_KUBERNETES_PVC_STRATEGY: "common"
CHE_INFRA_KUBERNETES_PVC_PRECREATE__SUBPATHS: "true"
CHE_INFRA_KUBERNETES_TLS__ENABLED: "false"
CHE_INFRA_KUBERNETES_TRUST__CERTS: "false"
CHE_INFRA_KUBERNETES_USERNAME: ""
CHE_LOCAL_CONF_DIR: /etc/conf
CHE_LOGS_DIR: /data/logs
CHE_PREDEFINED_STACKS_RELOAD__ON__START: "true"
CHE_LOG_LEVEL: INFO
CHE_PORT: "8080"
CHE_DEBUG_SERVER: "false"
CHE_OAUTH_GITHUB_FORCEACTIVATION: "true"
CHE_WORKSPACE_AUTO_START: "false"
CHE_KEYCLOAK_OSO_ENDPOINT: ""
CHE_KEYCLOAK_GITHUB_ENDPOINT: ""
CHE_SERVER_JAVA_OPTS: -XX:+UseG1GC -XX:+UseStringDeduplication -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:MaxRAM=700m -Xms256m
CHE_WORKSPACE_JAVA_OPTIONS: -XX:+UseG1GC -XX:+UseStringDeduplication -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:MaxRAM=1300m -Xms256m
CHE_KEYCLOAK_AUTH__SERVER__URL: not-in-use
CHE_KEYCLOAK_REALM: ""
CHE_KEYCLOAK_CLIENT__ID: ""
CHE_LOG_LEVEL: "INFO"
CHE_MULTIUSER: "false"
CHE_OAUTH_GITHUB_CLIENTID: ""
CHE_OAUTH_GITHUB_CLIENTSECRET: ""
CHE_PREDEFINED_STACKS_RELOAD__ON__START: "false"
JAVA_OPTS: "-XX:MaxRAMFraction=2 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true -Xms20m "
CHE_WORKSPACE_AUTO_START: "false"
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: che-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: 192.168.99.100.nip.io
http:
paths:
- backend:
serviceName: che-host
servicePort: 8080
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -98,189 +92,143 @@ items:
selector:
matchLabels:
app: che
strategy:
type: Recreate
template:
metadata:
annotations:
pod.alpha.kubernetes.io/init-containers: '[{"image":"busybox","imagePullPolicy":"IfNotPresent","name":"fmp-volume-permission","command":["chmod","777","/data"],"volumeMounts":[{"mountPath":"/data","name":"che-data-volume"}]}]'
labels:
app: che
spec:
containers:
- env:
- name: CHE_OAUTH_GITHUB_CLIENTID
valueFrom:
configMapKeyRef:
key: CHE_OAUTH_GITHUB_CLIENTID
name: che
- name: CHE_OAUTH_GITHUB_CLIENTSECRET
- name: CHE_HOST
valueFrom:
configMapKeyRef:
key: CHE_OAUTH_GITHUB_CLIENTSECRET
key: CHE_HOST
name: che
- name: CHE_MULTIUSER
- name: CHE_PORT
valueFrom:
configMapKeyRef:
key: CHE_MULTIUSER
key: CHE_PORT
name: che
- name: CHE_KEYCLOAK_AUTH__SERVER__URL
- name: CHE_API
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_AUTH__SERVER__URL
key: CHE_API
name: che
- name: CHE_KEYCLOAK_REALM
- name: CHE_WEBSOCKET_ENDPOINT
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_REALM
key: CHE_WEBSOCKET_ENDPOINT
name: che
- name: CHE_KEYCLOAK_CLIENT__ID
- name: CHE_DEBUG_SERVER
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_CLIENT__ID
key: CHE_DEBUG_SERVER
name: che
- name: CHE_INFRA_OPENSHIFT_MASTER__URL
- name: CHE_INFRASTRUCTURE_ACTIVE
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_MASTER__URL
key: CHE_INFRASTRUCTURE_ACTIVE
name: che
- name: CHE_INFRA_OPENSHIFT_USERNAME
- name: CHE_INFRA_KUBERNETES_BOOTSTRAPPER_BINARY__URL
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_USERNAME
key: CHE_INFRA_KUBERNETES_BOOTSTRAPPER_BINARY__URL
name: che
- name: CHE_INFRASTRUCTURE_ACTIVE
- name: CHE_INFRA_KUBERNETES_MACHINE__START__TIMEOUT__MIN
valueFrom:
configMapKeyRef:
key: CHE_INFRASTRUCTURE_ACTIVE
key: CHE_INFRA_KUBERNETES_MACHINE__START__TIMEOUT__MIN
name: che
- name: CHE_INFRA_OPENSHIFT_PASSWORD
- name: CHE_INFRA_KUBERNETES_MASTER__URL
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_PASSWORD
key: CHE_INFRA_KUBERNETES_MASTER__URL
name: che
- name: CHE_INFRA_OPENSHIFT_OAUTH__TOKEN
- name: CHE_INFRA_KUBERNETES_OAUTH__TOKEN
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_OAUTH__TOKEN
key: CHE_INFRA_KUBERNETES_OAUTH__TOKEN
name: che
- name: CHE_INFRA_OPENSHIFT_TRUST__CERTS
- name: CHE_INFRA_KUBERNETES_PVC_STRATEGY
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_TRUST__CERTS
key: CHE_INFRA_KUBERNETES_PVC_STRATEGY
name: che
- name: CHE_INFRA_OPENSHIFT_PVC_STRATEGY
- name: CHE_INFRA_KUBERNETES_PVC_PRECREATE__SUBPATHS
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_PVC_STRATEGY
key: CHE_INFRA_KUBERNETES_PVC_PRECREATE__SUBPATHS
name: che
- name: CHE_INFRA_OPENSHIFT_TLS__ENABLED
- name: JAVA_OPTS
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_TLS__ENABLED
key: JAVA_OPTS
name: che
- name: CHE_INFRA_OPENSHIFT_PROJECT
- name: CHE_INFRA_KUBERNETES_PASSWORD
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_PROJECT
key: CHE_INFRA_KUBERNETES_PASSWORD
name: che
- name: CHE_INFRA_OPENSHIFT_MACHINE__START__TIMEOUT__MIN
- name: CHE_INFRA_KUBERNETES_TLS__ENABLED
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_MACHINE__START__TIMEOUT__MIN
key: CHE_INFRA_KUBERNETES_TLS__ENABLED
name: che
- name: CHE_INFRA_OPENSHIFT_BOOTSTRAPPER_BINARY__URL
- name: CHE_INFRA_KUBERNETES_TRUST__CERTS
valueFrom:
configMapKeyRef:
key: CHE_INFRA_OPENSHIFT_BOOTSTRAPPER_BINARY__URL
key: CHE_INFRA_KUBERNETES_TRUST__CERTS
name: che
- name: CHE_WEBSOCKET_ENDPOINT
- name: CHE_INFRA_KUBERNETES_USERNAME
valueFrom:
configMapKeyRef:
key: CHE_WEBSOCKET_ENDPOINT
name: che
- name: CHE_LOGS_DIR
valueFrom:
configMapKeyRef:
key: CHE_LOGS_DIR
key: CHE_INFRA_KUBERNETES_USERNAME
name: che
- name: CHE_LOCAL_CONF_DIR
valueFrom:
configMapKeyRef:
key: CHE_LOCAL_CONF_DIR
name: che
- name: CHE_PREDEFINED_STACKS_RELOAD__ON__START
- name: CHE_LOGS_DIR
valueFrom:
configMapKeyRef:
key: CHE_PREDEFINED_STACKS_RELOAD__ON__START
key: CHE_LOGS_DIR
name: che
- name: CHE_LOG_LEVEL
valueFrom:
configMapKeyRef:
key: CHE_LOG_LEVEL
name: che
- name: CHE_PORT
valueFrom:
configMapKeyRef:
key: CHE_PORT
name: che
- name: CHE_DEBUG_SERVER
- name: CHE_MULTIUSER
valueFrom:
configMapKeyRef:
key: CHE_DEBUG_SERVER
key: CHE_MULTIUSER
name: che
- name: CHE_HOST
- name: CHE_OAUTH_GITHUB_CLIENTID
valueFrom:
configMapKeyRef:
key: CHE_HOST
key: CHE_OAUTH_GITHUB_CLIENTID
name: che
- name: CHE_API
- name: CHE_OAUTH_GITHUB_CLIENTSECRET
valueFrom:
configMapKeyRef:
key: CHE_API
key: CHE_OAUTH_GITHUB_CLIENTSECRET
name: che
- name: CHE_OAUTH_GITHUB_FORCEACTIVATION
- name: CHE_PREDEFINED_STACKS_RELOAD__ON__START
valueFrom:
configMapKeyRef:
key: CHE_OAUTH_GITHUB_FORCEACTIVATION
key: CHE_PREDEFINED_STACKS_RELOAD__ON__START
name: che
- name: CHE_WORKSPACE_AUTO__START
- name: CHE_WORKSPACE_AUTO_START
valueFrom:
configMapKeyRef:
key: CHE_WORKSPACE_AUTO_START
name: che
- name: JAVA_OPTS
valueFrom:
configMapKeyRef:
key: CHE_SERVER_JAVA_OPTS
name: che
- name: CHE_WORKSPACE_JAVA_OPTIONS
valueFrom:
configMapKeyRef:
key: CHE_WORKSPACE_JAVA_OPTIONS
name: che
- name: CHE_KEYCLOAK_OSO_ENDPOINT
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_OSO_ENDPOINT
name: che
- name: CHE_KEYCLOAK_GITHUB_ENDPOINT
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_GITHUB_ENDPOINT
name: che
- name: CHE_KEYCLOAK_AUTH__SERVER__URL
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_AUTH__SERVER__URL
name: che
- name: CHE_KEYCLOAK_REALM
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_REALM
name: che
- name: CHE_KEYCLOAK_CLIENT__ID
valueFrom:
configMapKeyRef:
key: CHE_KEYCLOAK_CLIENT__ID
name: che
image:
image: garagatyi/che-server:nightly
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -314,4 +262,4 @@ items:
volumes:
- name: che-data-volume
persistentVolumeClaim:
claimName: che-data-volume
claimName: che-data-volume

0 comments on commit 9de2754

Please sign in to comment.