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

Install Eclipse Che uses storage classes. #1039

Merged
merged 3 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
[id="proc_installing-che-using-storage-classes_{context}"]

= Installing {prod} using storage classes

:context: installing-che-using-storage-classes

{prod} has two components which require Persistent Volumes to store data:
* a Postgres database.
* an {prod} workspaces. {prod} workspaces store source code using volumes, for example `/projects` volume.

[NOTE]
====
Source code is stored in the Persistent Volume only if workspace is not ephemeral.
====

{prod} does not create Persisted Volumes in the infrastructure. {prod} uses Persisted Volume Claims (PVC) to mount Persisted Volumes. {prod} server creates Persisted Volume Claims.
You can define storage class name in the {prod} configuration to use storage classes feature in the {prod} PVC. With storage classes, you can configure infrastructure storage in a flexible way with a lot of storage parameters. You can also bind static provisioned Persisted Volumes to {prod} PVC using class name.

.Procedure

== Defining storage class names with the `server:start command`

* To provide storage class name for Postgres PVC, use the `chectl` `server:start` command with the `--postgres-pvc-storage-class-name` flag:
+
[source,bash]
----
$ chectl server:start -m -p minikube -a operator --postgres-pvc-storage-class-name=postgress-storage
----

* To provide storage class name for Che workspaces, use the `server:start` command with the `--workspace-pvc-storage-class-name` flag:
+
[source,bash]
----
$ chectl server:start -m -p minikube -a operator --workspace-pvc-storage-class-name=workspace-storage
----

For {prod} workspaces, storage class name has different behavior depending on a workspace PVC strategy.

[NOTE]
====
`postgres-pvc-storage-class-name=postgress-storage` and `workspace-pvc-storage-class-name` work for the operator installer and the Helm installer.
====

== Defining storage class names using a custom resources YAML file
You can define storage classe names using {prod} custom resources definition YAML.

.Procedure

. Create a YAML file with custom resources defined for the {prod} installation.
. Define fields: spec#storage#postgresPVCStorageClassName and spec#storage#workspacePVCStorageClassName.
+
[source,yaml]
----
apiVersion: org.eclipse.che/v1
kind: CheCluster
metadata:
name: eclipse-che
spec:
# ...
storage:
# ...
# keep blank unless you need to use a non default storage class for Postgres PVC
postgresPVCStorageClassName: 'postgres-storage'
# ...
# keep blank unless you need to use a non default storage class for workspace PVC(s)
workspacePVCStorageClassName: 'workspace-storage'
# ...
----

. Start the {prod-id-short} server with your custom resources:
+
[source,bash]
----
$ chectl server:start -m -p minikube -a operator --che-operator-cr-yaml=/path/to/custom/che/resource/org_v1_che_cr.yaml
----

== Binding static provisined volumes

Administrators can provision Persisted Volumes using class names.

.Procedure

. Define Persistent Volume for a Postgres database:
+
[source,yaml]
----
# che-postgres-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-pv-volume
labels:
type: local
spec:
storageClassName: postgres-storage
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/che/postgres"
----

. Define Persistent Volume for a {prod-short} workspace:
+
[source,yaml]
----
# che-workspace-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: workspace-pv-volume
labels:
type: local
spec:
storageClassName: workspace-storage
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/che/workspace"
----

. Bind the two Persisted Volumes:
[source,bash]
----
$ kubectl apply -f che-workspace-pv.yaml -f che-postgres-pv.yaml
----

[NOTE]
====
You must provide valid file permissions for volumes. You can do it using storage class configuration or manually. To manually define permission, define `storageClass#mountOptions` `uid` and `gid`. Postgres volume requires `uid=26` and `gid=26`.
====

== Configuring {prod} to store workspaces in one Persisted Volume

.Procedure

To configure {prod} to store all workspaces in one Persisted Volume:

. Modify your custom resources YAML file:

* Set `pvcStrategy` as `common`.

* Configure {prod-short} to start workspaces in the single namespace.

* Define storage class names for `postgresPVCStorageClassName` and `workspacePVCStorageClassName`.

* Example of the YAML file:
+
[source,yaml]
----
apiVersion: org.eclipse.che/v1
kind: CheCluster
metadata:
name: eclipse-che
spec:
server:
# ...
workspaceNamespaceDefault: 'che'
# ...
storage:
# ...
# Defaults to common
pvcStrategy: 'common'
# ...
# keep blank unless you need to use a non default storage class for Postgres PVC
postgresPVCStorageClassName: 'postgres-storage'
# ...
# keep blank unless you need to use a non default storage class for workspace PVC(s)
workspacePVCStorageClassName: 'workspace-storage'
# ...
----

. Start the {prod-id-short} server with your custom resources:
+
[source,bash]
----
$ chectl server:start -m -p minikube -a operator --che-operator-cr-yaml=/path/to/custom/che/resource/org_v1_che_cr.yaml
----
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This section describes how to properly configure an LXC container to set up Mini

[discrete]
=== Background
The `chectl` command-line tool requires the Minikube Ingress plug-in to be enabled in Minikube. At the same time, the Minikube Ingress plug-in requires the Docker daemon to be running with the overlay filesystem driver.
The `chectl` command-line tool requires the Minikube Ingress plug-in to be enabled in Minikube. At the same time, the Minikube Ingress plug-in requires the Docker daemon to be running with the overlay filesystem driver.

[discrete]
=== Problem
Expand Down