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

Fix: disable persistent home when ephemeral storage used; persistent home volume shouldn't use capital letters #1210

Merged
merged 2 commits into from
Nov 23, 2023

Conversation

AObuchow
Copy link
Collaborator

What does this PR do?

This PR makes 2 fixes to the $HOME persistence feature in DWO:

  • The persistent home devfile volume is now only added if the DWOC's workspace.persistUserHome.enabled: true field is set, and the workspace requires persistent storage (i.e. it uses the uses async, per-workspace or per-user storage strategy and has at least one-non ephemeral volume or has mount-sources enabled).
  • The persistent home volume name was changed from persistentHome -> persistent-home to be a valid Kubernetes name.

(Sorry for putting 2 bug fixes in a single PR - it seemed to make sense since they're both related)

What issues does this PR fix or reference?

#1200 & #1203

Is it tested? How?

Initial setup

  1. Set the $DWO_IMG environment variable to point to your quay repository for DWO, e.g: export DWO_IMG=quay.io/<your-username>/devworkspace-controller:next
  2. Run make install_cert_manager docker install if testing on Minikube. For openshift, run make docker install
  3. Enable persistUserHome in the DWOC: kubectl edit dwoc -n $NAMESPACE
apiVersion: controller.devfile.io/v1alpha1                                                                                                                                 
config:                                                                                                                                                                    
  routing:                                                                                                                                                                 
    clusterHostSuffix: 192.168.49.2.nip.io                                                                                                                                 
    defaultRoutingClass: basic                                                                                                                                             
  workspace:                                                                                                                                                               
    imagePullPolicy: Always                                                                                                                                                
+    persistUserHome:                                                                                                                                                       
+      enabled: true                                                                                                                                                        
kind: DevWorkspaceOperatorConfig

Testing fix for #1200

  1. Create a devworkspace that uses persistent storage. The plain-devworkspace sample will suffice: kubectl apply -f ./samples/plain.yaml
  2. Ensure the workspace starts up successfully with kubectl get dw -n $NAMESPACE -w
  3. Check the workspace pod's spec, and verify it has a volumeMount with a subPath set to /persistent-home. For example:
(...)
        volumeMounts:                                                                                                                                                                                                                                                                            
        - mountPath: /home/user/                                                                                                                                           
          name: claim-devworkspace                                                                                                                                         
          subPath: workspace1835a0b4d9f04fd2/persistent-home   
(...)

Testing fix for #1203

  1. Create a devworkspace that uses ephemeral storage. The following devworkspace can be used:
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: plain-devworkspace-ephemeral
spec:
  started: true
  routingClass: 'basic'
  template:
    attributes:
        controller.devfile.io/storage-type: ephemeral
    components:
      - name: web-terminal
        container:
          image: quay.io/wto/web-terminal-tooling:next
          memoryRequest: 256Mi
          memoryLimit: 512Mi
          mountSources: true
          command:
           - "tail"
           - "-f"
           - "/dev/null"
  1. Ensure the workspace starts up successfully with kubectl get dw -n $NAMESPACE -w
$ kubectl get dw -n $NAMESPACE -w
NAME                           DEVWORKSPACE ID             PHASE     INFO
plain-devworkspace-ephemeral   workspace03197f210f9247e4   Running   Workspace is running

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (093bb40) 52.82% compared to head (4d83873) 52.84%.

Files Patch % Lines
controllers/workspace/devworkspace_controller.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1210      +/-   ##
==========================================
+ Coverage   52.82%   52.84%   +0.01%     
==========================================
  Files          84       84              
  Lines        7604     7604              
==========================================
+ Hits         4017     4018       +1     
+ Misses       3300     3299       -1     
  Partials      287      287              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

openshift-ci bot commented Nov 23, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described 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

@AObuchow AObuchow merged commit 33a124b into devfile:main Nov 23, 2023
5 of 6 checks passed
@AObuchow AObuchow deleted the persistent-home-ephemeral-fix branch November 23, 2023 15:14
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.

2 participants