-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add a CheCluster configuration to persist workspaces $HOME #22102
Comments
I haven't tested this, but are there any potential issues with workspaces that already mount subdirectories within the home directory? E.g. for our Java sample, we currently explicitly mount For some reference, the Web Terminal tooling container currently does the suggested copy-files-to-$HOME step in its entrypoint, based off of an initial config directory: source. We do this to allow user-specified containers that use alternate dotfiles (e.g. |
In my testing, this should be okay. I was able to mount a PVC within a PVC used by a devworkspace. The resulting volumeMounts in the devworkspace pod spec looked like: volumeMounts:
(...)
- name: my-pvc
mountPath: /home/user/my-pvc
- name: my-inner-pvc
mountPath: /home/user/my-pvc/my-inner-pvc |
@l0rd some questions:
|
|
@l0rd Thank you for the clarification 😎 Some other questions & thoughts regarding this feature:
|
@l0rd @AObuchow FWIW, I would prefer for the My preference would be for a persisted If I intentionally delete a workspace, then I am stating that I no longer want its state to be retained. My $0.02... That's in USD... ;-) |
I'll throw in my C$0.02 and agree with @cgruver. Sharing $HOME across all workspaces in a namespace could lead to unforeseen issues depending on what gets stored there. A potential issue that comes to mind is locally-installed python modules, which would be stored in It also helps that persisting $HOME per-workspace is a lot easier to implement on our end -- DWO already supports all the pieces (including cleanup) necessary to do this. To hopefully add some clarity here, the two main approaches being discussed can be applied manually in current Che versions:
For dotfiles/configuration that you truly would want to share for all workspaces (e.g. |
It seems like the common consensus is to not persist $HOME across workspaces (even when using the common/per-user storage strategy), so I will go with that approach. However, we may want to enable sharing $HOME across workspaces in the future (or add other persistent $HOME settings) if requested by users. So I propose the Che Cluster CR field be a struct to hold the persistent $HOME settings: kind: CheCluster
apiVersion: org.eclipse.che/v2
spec:
devEnvironments:
storage:
pvcStrategy: per-workspace
persistentUserHomeDirectoryConfig:
enabled: <bool> If anyone has a better field name than |
;-) |
Update: I've submitted the DWO-side PR. Once this is merged, I will have to get a Che-Operator PR merged as well for this issue to be resolved. |
The DWO-side PR is now merged. Once the next DWO release happens, the required Che-Operator PR can be merged (still need to submit it) and this issue will be resolved. |
So the issue has been solved? So how do I implement it? config:
workspace:
persistentHomeUserDirectoryConfig:
enabled: <bool>
+ shareHomePerUser: <bool> But my dev-file in Openshift DevSpaces doesn't seem to have those variable names. I do see a reference to repo/-/tree/main with a file called .che/che-editor.yaml. But that only contains the line Could anyone explain to me how to implement this persistent config? |
@aufbakanleitung sorry for the confusion. The |
Fix eclipse-che/che#22102 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
The Che Operator PR has now been submitted, once merged we can mark this issue as resolved. |
Fix eclipse-che/che#22102 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Fix eclipse-che/che#22102 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Part of eclipse-che/che#22102 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Ignore the reference to devfile/developer-images#108, this was done by accident |
This feature is now merged into upstream Che. To try it out, edit the checluster CR (i.e. When enabled, this feature will automatically add a volume mount to all workspace pods that mounts to your PVC at Note: the workspace image's |
Really nice that this (pretty important) feature could be integrated so quickly!
Also the I'm at a loss about what to do now. Does anyone here have experience with configuration in DevSpaces, and perhaps a solution? |
@aufbakanleitung You should be able to find the CheCluster for your install by just checking all namespaces -- it may not be present in a default namespace: The section of documentation you linked is a warning against editing the downstream objects (configmaps, secrets, etc.) as they are defined by the CheCluster, which you can (and should) edit to suit your needs. |
Thanks @amisevsk! Indeed your command found the CheCluster, and with spec:
devEnvironments:
persistUserHome:
enabled: true I also tried the more common I'm considering removing the entire CheCluster and spinning up a new one with this setting; to make sure everything is up to date. |
Not sure what version of Dev Spaces you are using but this configuration will be in 3.8 that is going to be GA at the end of the month (i.e. you can only test it with latest Eclipse Che or Dev Spaces 3.8 preview). |
Ah I already removed the current one and spun up a new one, but indeed no effect. |
@aufbakanleitung if you have a non-prod cluster to start playing with it I had prepared these scripts to enable it in 3.7. |
Thanks @l0rd ! See here my log: chmod +x 1_create_catalog_source.sh
chmod +x 2_patch_subscription.sh
chmod +x 3_patch_dwoc.sh
./1_create_catalog_source.sh
# catalogsource.operators.coreos.com/devworkspace-operator-catalog created
./2_patch_subscription.sh
# Error from server (NotFound): subscriptions.operators.coreos.com "devworkspace-operator-fast-redhat-operators-openshift-marketplace" not found
oc get subscription --all-namespaces
NAMESPACE NAME PACKAGE SOURCE CHANNEL
nvidia-gpu-operator gpu-operator-certified gpu-operator-certified certified-operators v23.3
openshift-nfd nfd nfd redhat-operators stable
openshift-operators devspaces-subscription devspaces redhat-operators stable
pyflask-demo rhsso-operator rhsso-operator redhat-operators stable
sso rhsso-operator rhsso-operator redhat-operators stable
# Renamed variable: SUB_NAME="devspaces-subscription"
./2_patch_subscription.sh
# subscription.operators.coreos.com/devspaces-subscription patched
./3_patch_dwoc.sh
# devworkspaceoperatorconfig.controller.devfile.io/devworkspace-config patched (no change)
oc edit dwoc # Decide to manually "add config.workspace.persistUserHome.enabled: true"
# doesn't persist Once again editting the config and adding |
Aii I just noticed I'm not even running 3.7 😅
Okay, I'll fix that first then. Sorry for the confusion. |
My bad: the I am not sure why it doesn't persist the DWOC change but between the 2nd and 3rd step you should wait that the operator gets updated. The procedure should work even if you are using 3.5 but then you deployment may get broken in unpredictable ways. So yes you had better test that on a cluster where you have 3.7. |
Hey @l0rd, I've updated to DevSpaces 3.7 but the patching of the DWOC still doesn't work; nor does changing it manually. Changing something else, like setting For my understanding, how is changing the upstream catalog source and the patching the subscription supposed to do? I expected your scripts to create a pvc and link the home directories for all the DevSpaces instances to it. |
The first 2 scripts upgrade the DevWorkspace operator to v0.22. The third script changes the configuration of that operator to automatically persist |
So Redhat finally pushed the 3.9 Che version (3.9 :: Eclipse Che Dashboard 7.74.0) and now I was able to add the
However when I close and open a workspace and press arrow up in the Terminal I still don't see my history. Any idea what I should do to make it work? |
@aufbakanleitung it may be due to how the in-browser terminal handles history. We had a similar issue in the Web Terminal Operator and fixed it by adding the following to our default .bashrc:
(see here) |
Ah nice! Good solution, thanks @amisevsk! |
That |
Is your enhancement related to a problem? Please describe
We want to allow users to automatically persist files and folders in their workspaces home directory. Folders such as ~/.m2 would be persisted without any extra setup.
Describe the solution you'd like
A new field
persistUserHomeDirectory
in CheCluster. If set to true than the workspaces home folders will be persisted as the/projects/
folder.The
pvcStrategy
(per-workspace, per-user, ephemeral) will be honored.The universal developer image should be updated so that files will be copied or linked to
$HOME
at startup (using the entrypoint). We should avoid to copy files to$HOME
when possible as this slows down the workspace startup.The default is not to persist the home directory. That's because allowing developers to persist changes of the home directory may break the reproducibility of the development environments.
The text was updated successfully, but these errors were encountered: