question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to `volumeMount` on a `hostPath` in `eclipse-che` ?

See original GitHub issue

Summary

When i create a simple pod with a kubernetes cluster, i will have the flexibility to add volumeMounts that points to a hostPath in pod.yaml file

incase of the below pod.yaml file , if there are any files generated and stored within /app/ntemp, those files will be available in my localComputer’s hostPath: /Users/divine/Documents/minikubehostvolume

below is the pod.yaml configuration which i have used to implement the above scenario.

apiVersion: v1
kind: Pod
metadata:
  name: mydemonodejs
  labels:
    app: mydemonodejslabel
spec:
  containers:
  - image: divine6/myapp:2.0
    name: myappcontainer
    ports:
    - containerPort: 3000
    volumeMounts:
    - mountPath: /app/ntemp
      name: demonodejsvolume
  volumes:
  - name: demonodejsvolume
    hostPath:
      path: /Users/divine/Documents/minikubehostvolume
      type: Directory

Here is my question,

in case of eclipse-che, how can i use hostPath in my devfile.yaml ? Below i my devfile.yaml. i looked into the devfile2.1.0 spec, but i’m not able to find an option to add hostPath to a volume.

My intention is to add a directory or NFS storage as a volume to a container in devfile.yaml.

Please let me know how to implement this scenario .

schemaVersion: 2.1.0
metadata:
  name: introselenium-service
projects:
  - name: seleniumservice
    git:
      checkoutFrom:
        revision: main
      remotes:
        origin: https://gitlab.organizationcom/divine/introselenium.git
components:
  - container:
      image: 'quay.io/devfile/universal-developer-image:ubi8-0e189d9'
      memoryLimit: 2G
      endpoints:
        - exposure: none
          name: debug
          protocol: tcp
          targetPort: 5005
        - exposure: public
          name: 8080-http
          protocol: http
          targetPort: 8080
      volumeMounts:
        - name: m2
          path: /home/user/.m2
    name: tools
  - container:
      image: 'selenium/standalone-chrome:4.1.2-20220217'
      memoryLimit: 3G
      endpoints:
        - exposure: public
          name: 4444-tcp
          protocol: tcp
          targetPort: 4444
        - exposure: public
          name: 5900-tcp
          protocol: tcp
          targetPort: 5900
        - exposure: public
          name: 7900-http
          protocol: http
          targetPort: 7900
          secure: true
      volumeMounts:
        - name: m2
          path: /home/user/.m2
    name: selenium
  - name: m2
    volume:
      size: 2G
commands:
  - exec:
      commandLine: mvn clean package -DskipTests
      component: tools
      group:
        isDefault: true
        kind: build
      label: 'build project using maven'
      workingDir: '${PROJECT_SOURCE}'
    id: mvnpackage

Relevant information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sparkoocommented, Mar 14, 2022

@Divine1 that’s a good question and as I’m thinking about it, maybe I was wrong in my previous comment. We’re adding the random part because of possible conflicts when we’re modifying the username. So there would be same possible conflict if you use divine-chelladurai in the annotation. Looking at the code, you might need to use original value in the annotation (Divine Chelladurai), but I’m not 100% sure, sorry. Can you please test both? It is also possible that there is inconsistency in Che there.

Another option is to use custom OIDC claim as username. Name Surname is probably not the best option as there might be conflicts as well. You can set it with CHE_OIDC_USERNAME__CLAIM and you would need to reconfigure Kubernetes apiserver and Dex to same claim.

1reaction
sparkoocommented, Mar 14, 2022

@Divine1 username is taken from name oidc claim. By this documentation https://docs.gitlab.com/ee/integration/openid_connect_provider.html#shared-information name | string | The user’s full name. So Che takes your name and make it dns valid (lower case, no spaces, …) and use it as username. So if you want to precreate namespace, you should set che.eclipse.org/username: divine-chelladurai annotation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring storage classes :: Eclipse Che Documentation
Che uses persistent volume claims (PVC) to mount persistent volumes. ... storage: 1Gi accessModes: - ReadWriteOnce hostPath: path: "/data/che/postgres".
Read more >
How to mount volumes in eclipse che workspaces running ...
First user registration will happen via keycloak and then the workspace will be created. This means a new kubernetes namespace will also be ......
Read more >
Kubernetes volume hostPath explained with examples
The hostPath volume mounts a resource from the host node filesystem. the resources could be directory, file socket, character, ...
Read more >
Using hostPath - Configuring Persistent Storage
A hostPath volume in an OpenShift Container Platform cluster mounts a file or directory from the host node's file system into your pod....
Read more >
Chapter 3. Configuring OpenShift Dev Spaces
apiVersion: org.eclipse.che/v2 kind: CheCluster metadata: name: devspaces spec: ... A special host path; A storage capacity; A volume mod; Mount options ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found