Skip to content
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

Allow enabling persistence of /home/user/ in workspaces #1737

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

AObuchow
Copy link
Contributor

@AObuchow AObuchow commented Jul 20, 2023

What does this PR do?

This PR adds 2 new fields to the Che Cluster CR:

  • spec.devEnvironments.persistUserHome: holds config settings related to the persistence of /home/user/ in workspaces
  • spec.devEnvironments.persistUserHome.enabled determines whether /home/user/ will persist in workspaces. Disabled by default.

Note: this PR depends on DWO 0.22.0 which has currently only been released upstream.

Screenshot/screencast of this PR

n/a

What issues does this PR fix or reference?

eclipse-che/che#22102

How to test this PR?

Ensure that changes to spec.devEnvironments.persistUserHome.enabled from the Che Cluster CR are propagated to the Che-owned DWOC's config.workspace.persistUserHome:

  1. Setting spec.devEnvironments.persistUserHome.enabled: true in the Che Cluster CR results in config.workspace.persistUserHome.enabled: true for the Che-owned DWOC
  2. Setting spec.devEnvironments.persistUserHome.enabled: false in the Che Cluster CR results in config.workspace.persistUserHome.enabled: false for the Che-owned DWOC
  3. Removing spec.devEnvironments.persistUserHome in the Che Cluster CR (i.e. setting it to nil) removes config.workspace.persistUserHome in the Che-owned DWOC

For example, for test case 1. do:

  1. kubectl edit checluster -n eclipse-che
(...)
spec:
(...)
  devEnvironments:
    containerBuildConfiguration:
      openShiftSecurityContextConstraint: container-build
    defaultNamespace:
      autoProvision: true
      template: <username>-che
    maxNumberOfWorkspacesPerUser: -1
+    persistUserHome:
+      enabled: true
    secondsOfInactivityBeforeIdling: 1800
    secondsOfRunBeforeIdling: -1
    startTimeoutSeconds: 300
    storage:
      pvcStrategy: per-user
  1. kubectl describe dwoc -n eclipse-che and ensure persistUserHome is now enabled:
Name:         devworkspace-config  
Namespace:    eclipse-che  
Labels:       <none>  
Annotations:  <none>  
API Version:  controller.devfile.io/v1alpha1  
Config:  
 Workspace:  
   Container Security Context:  
     Allow Privilege Escalation:  true  
     Capabilities:  
       Add:  
         SETGID  
         SETUID  
   Deployment Strategy:  Recreate  
+   Persist User Home:  
+     Enabled:         true  
   Progress Timeout:  300s  
   Service Account:  
     Disable Creation:  false  
Kind:                    DevWorkspaceOperatorConfig

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

@openshift-ci
Copy link

openshift-ci bot commented Jul 20, 2023

Hi @AObuchow. Thanks for your PR.

I'm waiting for a eclipse-che member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #1737 (a63572c) into main (923972e) will decrease coverage by 0.10%.
The diff coverage is 29.62%.

❗ Current head a63572c differs from pull request most recent head 3e2c49e. Consider uploading reports for the commit 3e2c49e to get more accurate results

@@            Coverage Diff             @@
##             main    #1737      +/-   ##
==========================================
- Coverage   60.06%   59.96%   -0.10%     
==========================================
  Files          71       71              
  Lines        8423     8450      +27     
==========================================
+ Hits         5059     5067       +8     
- Misses       3017     3036      +19     
  Partials      347      347              
Impacted Files Coverage Δ
api/v2/checluster_types.go 22.64% <ø> (ø)
api/v2/zz_generated.deepcopy.go 0.00% <0.00%> (ø)
...eploy/dev-workspace-config/dev_workspace_config.go 94.36% <100.00%> (+0.33%) ⬆️

Copy link
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM; IIRC this is one we were considering backporting to 7.72.x

pkg/deploy/dev-workspace-config/dev_workspace_config.go Outdated Show resolved Hide resolved
pkg/deploy/dev-workspace-config/dev_workspace_config.go Outdated Show resolved Hide resolved
@@ -85,6 +85,10 @@ type CheClusterDevEnvironments struct {
// +optional
// +kubebuilder:default:={pvcStrategy: per-user}
Storage WorkspaceStorage `json:"storage,omitempty"`
// PersistUserHome defines configuration options for persisting the `/home/user/`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not to mention specifically /home/user?
For instance: Defined configuration options for persisting a home user directory in a workspace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's okay with me, will make the appropriate change 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not modify the documentation for persistUserHome.enabled to remove the mention of /home/user/ as it felt appropriate to explicitly state which directory would persist. However, I am open to reconsidering this decision.

@tolusha
Copy link
Contributor

tolusha commented Jul 24, 2023

@AObuchow
Could you run make update-dev-resources and commit changes

@AObuchow
Copy link
Contributor Author

@AObuchow Could you run make update-dev-resources and commit changes

Done 👍 I removed the original update dev resources commit and re-ran make update-dev-resources

// Must be used with the 'per-user' or 'per-workspace' PVC strategy in order to take effect.
// Disabled by default.
Enabled *bool `json:"enabled,omitempty"`
// Determines whether the `/home/user/` directory in workspaces should persist between
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tolusha is this formatting problematic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a problem.
Could you remove references to /home/user from the comments in checluster_types.go and regenerate dev resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do 👍

Fix eclipse-che/che#22102

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
…config

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
@AObuchow
Copy link
Contributor Author

I believe the failing tests are due to che-server:next currently having a bug that's causing a crash loop backoff

@tolusha
Copy link
Contributor

tolusha commented Jul 25, 2023

/retest

@openshift-ci
Copy link

openshift-ci bot commented Jul 25, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amisevsk, AObuchow, tolusha

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ibuziuk ibuziuk merged commit cbf068f into eclipse-che:main Jul 27, 2023
13 checks passed
@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.9 :: copyIIBsToQuay/1554: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.9 :: sync-to-downstream_3.x/3815: SUCCESS

Build container: devspaces-operator-bundle synced; /DS_CI/get-sources-rhpkg-container-build_3.x/3665 triggered; /job/DS_CI/job/dsc_3.x triggered;

@devstudio-release
Copy link

Build 3.9 :: operator-bundle_3.x/1628: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/3815 triggered

@devstudio-release
Copy link

Build 3.9 :: dsc_3.x/1053: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.9 :: dsc_3.x/1053: SUCCESS

3.9.0 CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants