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

Update recipes documentation to add deployments and configmaps #647

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 63 additions & 35 deletions src/main/pages/che-6/workspace-admin/recipes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,50 +156,78 @@ The `env_file` Compose option is not supported. Environment variables can be man
[id="kubernetes-yaml-limitations-and-restrictions"]
== Kubernetes YAML limitations and restrictions

When a workspace is starting, Che creates a https://kubernetes.io/docs/concepts/workloads/pods/pod/[Kubernetes pod]. The following are limitatons and restrictions:
When a workspace is starting, Che creates various Kubernetes resources to support the IDE and development tools. Workspaces primarily consist of a https://kubernetes.io/docs/concepts/workloads/controllers/deployment/[Deployment] which runs a https://kubernetes.io/docs/concepts/workloads/pods/pod/[Kubernetes pod]. The following are limitatons and restrictions:
Copy link
Member

Choose a reason for hiding this comment

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

@amisevsk maybe it would be a good idea to add info about replicas limitations that should only be 1 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could; I didn't add it because I think it's kind of common sense, and the validator will block stack creation, and currently KubernetesDeployments will directly set replicas to 1 if you happen to modify it.

I would rather keep the docs as short as possible and only cover the weird cases we require.


1. Che allows users to create only pods and services.
2. Other object kinds will be ignored (PVC and route) or a workspace fails to start with an exception from Kubernetes.
3. You cannot use volumes in the container and pod definition. See link:volumes.html[Volumes] for information about persisting and sharing data between pods.
. Che allows users specify Pods, Deployments, ConfigMaps, and Services in recipes
- If a Pod is specified, it will be wrapped in a simple Deployment when running the workspace
. Other object kinds will be ignored (PVC and route) or a workspace fails to start with an exception from Kubernetes.
. Che performs some minimal validation of Kubernetes YAML, but invalid yaml in a recipe can cause workspaces to fail to run (e.g. referring to a non-existent configmap)
. You cannot use volumes in the container and pod definition. See link:volumes.html[Volumes] for information about persisting and sharing data between pods.

The following is an example of a custom recipe with two containers and one pod, and a service that is bound to port 8081:
The following is an example of a custom recipe with two containers, a simple config map, one deployment, and a service that is bound to port 8081:

[source,yaml]
----
kind: List
items:
-
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
selector:
name: app
ports:
- protocol: TCP
port: 8081
targetPort: 8081
-
apiVersion: v1
kind: Pod
metadata:
name: app
spec:
containers:
-
image: eclipse/ubuntu_jdk8:latest
name: main
ports:
-
containerPort: 8081
protocol: TCP
-
image: eclipse/ubuntu_jdk8:latest
name: main1
-
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
replicas: 1
selector:
matchLabels:
my-workspace-pod: dev
template:
metadata:
name: dev-pod
labels:
my-workspace-pod: dev
spec:
containers:
-
image: eclipse/ubuntu_jdk8:latest
name: main
ports:
-
containerPort: 8081
protocol: TCP
env:
-
name: MY_ENV_VAR
valueFrom:
configMapKeyRef:
name: my-configmap
key: my-key
-
image: eclipse/ubuntu_jdk8:latest
name: main1
-
apiVersion: v1
kind: ConfigMap
metadata:
name: my-configmap
data:
my-key: my-value
-
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
selector:
name: app
ports:
- protocol: TCP
port: 8081
targetPort: 8081
----

You can also have one pod and several containers in it. Che treats those containers as workspace machines. You can also define machine names in annotations. `PodName/Container Name` is the default naming pattern for a machine.
As a bare minimum, a Kubernetes YAML recipe must contain at least one Pod or Deployment, in which the main dev machine is run.

You can also specify multiple containers within the workspace pod. Che treats those containers as workspace machines. These containers can have machine names defined in annotations. `PodName/Container Name` is the default naming pattern for a machine.

The following is an example of using annotations:

Expand Down