how to `volumeMount` on a `hostPath` in `eclipse-che` ?
See original GitHub issueSummary
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:
- Created 2 years ago
- Comments:15 (7 by maintainers)
Top GitHub Comments
@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 withCHE_OIDC_USERNAME__CLAIM
and you would need to reconfigure Kubernetes apiserver and Dex to same claim.@Divine1 username is taken from
name
oidc claim. By this documentation https://docs.gitlab.com/ee/integration/openid_connect_provider.html#shared-informationname | 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 setche.eclipse.org/username: divine-chelladurai
annotation.