Eclipse Che has two components which require Persistent Volumes to store data:
* a PostgreSQL database.
* an Eclipse Che workspaces. Eclipse Che workspaces store source code using volumes, for example /projects volume.
|
Source code is stored in the Persistent Volume only if workspace is not ephemeral. |
Eclipse Che does not create Persisted Volumes in the infrastructure. Eclipse Che uses Persisted Volume Claims (PVC) to mount Persisted Volumes. Eclipse Che server creates Persisted Volume Claims. You can define storage class name in the Eclipse Che configuration to use storage classes feature in the Eclipse Che 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 Eclipse Che PVC using class name.
Defining storage class names with the server:start command
-
To provide storage class name for PostgreSQL PVC, use the
chectlserver:startcommand with the--postgres-pvc-storage-class-nameflag:$ 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:startcommand with the--workspace-pvc-storage-class-nameflag:$ chectl server:start -m -p minikube -a operator --workspace-pvc-storage-class-name=workspace-storage
For Eclipse Che workspaces, storage class name has different behavior depending on a workspace PVC strategy.
|
|
Defining storage class names using a custom resources YAML file
You can define storage classes names using Eclipse Che custom resources definition YAML.
-
Create a YAML file with custom resources defined for the Eclipse Che installation.
-
Define fields:
spec#storage#postgresPVCStorageClassNameandspec#storage#workspacePVCStorageClassName.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 PostgreSQL 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 che server with your custom resources:
$ chectl server:start -m -p minikube -a operator --che-operator-cr-yaml=/path/to/custom/che/resource/org_v1_che_cr.yaml
Binding static provisioned volumes
Administrators can provision Persisted Volumes using class names.
-
Define Persistent Volume for a PostgreSQL database:
# 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 Che workspace:
# 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:
$ kubectl apply -f che-workspace-pv.yaml -f che-postgres-pv.yaml
|
You must provide valid file permissions for volumes. You can do it using storage class configuration or manually. To manually define permission, define |
Configuring Eclipse Che to store workspaces in one Persisted Volume
To configure Eclipse Che to store all workspaces in one Persisted Volume:
-
Modify your custom resources YAML file:
-
Set
pvcStrategyascommon. -
Configure Che to start workspaces in the single namespace.
-
Define storage class names for
postgresPVCStorageClassNameandworkspacePVCStorageClassName. -
Example of the YAML file:
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 PostgreSQL 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 che server with your custom resources:
$ chectl server:start -m -p minikube -a operator --che-operator-cr-yaml=/path/to/custom/che/resource/org_v1_che_cr.yaml