Che: Add additional PVC for workspace

Created on 18 Aug 2020  路  12Comments  路  Source: eclipse/che

Dear forum members,

I'm running che in Minikube. I have a Persistent Volume (PV) created within the minikube single node.

and would like to access this PV from within my workspace. As this is not currently supported, I would like to try implementing it with your guidance.

Kindly provide me guidance on where I need to look to make changes to the code.
So far, I have seen the code in infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes.
I have read UniqueWorkspacePVCStrategy, PVCProvisioner.java, etc.

@skabashnyuk , forum members recommended that I get in touch with you regarding this. Thank you !

arewsmaster kinquestion severitP2

Most helpful comment

And thank you for the willingness to help us out with this. Much appreciated! Please don't hesitate to bombard us with further questions :smile:

All 12 comments

I would also look into PodMerger and into KubernetesInternalRuntime.

And thank you for the willingness to help us out with this. Much appreciated! Please don't hesitate to bombard us with further questions :smile:

Thank you @metlos for encouraging ...
I would like to create a prototype first as a proof of concept... looking for a quick and dirty way to "hard-code" the pvc creation ...

@svkr2k how this feature will work? What if we use the same approach as we use with secrets? If PV exists in the namespace with some labels we can mount it to the workspace? See https://www.eclipse.org/che/docs/che-7/mounting-a-secret-as-a-file-or-an-environment-variable-into-a-workspace-container/
CC @l0rd

Thank you for letting me know your thoughts, @skabashnyuk

The approach for prototype (che on minikube) that I'm going to try is as follows:

  1. I shall create a PV for a host path such as /home/huge-set-of-files that exists in my local PC
  2. When a workspace is created, create a PVC (in the namespace of workspace) that claims the PV created in step 1
  3. Mount the PVC to a path /home/huge-set-of-files in the IDE container of the workspace

Hope this sounds okay ?
Finally, if this works, I would like to change the hostPath-based PV into a NFS-based PV.

@svkr2k 锛宧i, how is the result?
i have the same demand and i deployed eclipse-che in k8s (private cloud enviroment and operator installer ).
i tested the hostPath PV and NFS PV , i can get it using kubectl command , however the pv or pvc can not be mounted into the workspace.
It seemed that the Volume attribute in devfile is not valid.
@skabashnyuk ,could you give me some advice ?
thanks a lot.

What about

A volume that is going to be mounted to the all containers of the workspace pod.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: task-pv-volume
  labels:
    type: local
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspace-shared-volume
  annotations:
    che.eclipse.org/automount-workspace-shared-volume: 'true'
    che.eclipse.org/mount-path:/home/huge-set-of-files 
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

A volume that is going to be mounted to the specific container of the workspace pod.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: task-m2-voluem
  labels:
    type: local
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspace-shared-volume
  annotations:
    che.eclipse.org/target-container: maven
    che.eclipse.org/mount-path:/home/user/.m2/repository
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

CC @mshaposhnik @l0rd @metlos @sparkoo Wdyt?

@skabashnyuk
thanks for your reply.
I tried the configuration you recommended above . Unfortunately 锛孖t did not work.
Whether i put the volumes part into the devfile or not ,the external volume could not be mounted into the container .
The following is devfile.yaml

metadata:
generateName: wksp-test-
components:

  • mountSources: true
    command:

    • sleep

    • infinity

      memoryLimit: 600Mi

      type: dockerimage

      volumes:

    • name: task-pv-volume

      containerPath: /external_tool

      image:

      alias: test

      apiVersion: 1.0.0

BTW ,
che.eclipse.org/mount-path:/home/huge-set-of-files ----is this path the container path?
What is the correlation between the che.eclipse.org/mount-path and containerPath in devfiles ?(componet->volumes)

I tried the configuration you recommended above . Unfortunately 锛孖t did not work.

Did you implement that in the che-server code? https://github.com/eclipse/che/issues/17653#issuecomment-679921862 this is a proposal for configuration. It's not implemented yet.

che.eclipse.org/mount-path:/home/huge-set-of-files ----is this path the container path?

yes. Similar to the secrets mount path see https://www.eclipse.org/che/docs/che-7/mounting-a-secret-as-a-file-or-an-environment-variable-into-a-workspace-container/

What is the correlation between the che.eclipse.org/mount-path and containerPath in devfiles ?(componet->volumes)

I don't know. Probably none.

@skabashnyuk
oh , i got it. Yes, i did not modify the che-server code ,i just used the original image (7.17.0).
The feature is expected strongly .

And , another confusing problem , that is , what is the recommended size limit of the workspace container .
Since at present i can not add the external pvc into workspace ,i want to try to load the files into workspace .
Is the capacity relevant to the che server cofig (server-storage-pvcClaimSize)?
thank you for your help .

@skabashnyuk , @whafra

Did you implement that in the che-server code? #17653 (comment) this is a proposal for configuration. It's not implemented yet.

I havent got a chance to implement it yet. Had a look at the code for a couple of days and as I'm not familiar with che server code, I believe that I will need more help in understanding where to start ... :-)

Possible duplicate for #15652

Was this page helpful?
0 / 5 - 0 ratings