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

feat: 'one PVC per-workspace' storage class #818

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

AObuchow
Copy link
Collaborator

@AObuchow AObuchow commented Apr 13, 2022

What does this PR do?

This PR adds a new storage class called 'perWorkspace'. When in use in the devfile, every workspace gets its own PVC.

What issues does this PR fix or reference?

Fix #792

Is it tested? How?

In order to enable the 'perWorkspace' storage class, the controller.devfile.io/storage-type devfile attribute must be set to per-workspace.

Eg.

spec:
  template:
    attributes:
        controller.devfile.io/storage-type: per-workspace

Manual testing:

  • Start up DWO (i.e. make run)
  • Apply the sample devfile that uses the perWorkspace storage class: kubectl apply -f ./samples/theia-next_per-workspaceStorage.yaml -n $NAMESPACE
  • Check K8s status (through terminal or dashboard) and ensure a PVC has been created for the workspace. The naming of the PVC should be of the form storage-[workspaceID]
  • Delete the workspace: kubectl delete dw theia-next -n $NAMESPACE
  • Ensure the PVC is also deleted shortly after (check K8s dashboard for PVC or use terminal commands)

Automated testing:
There is also a new test file, pkg/provision/storage/perWorkspaceStorage_test.go.
It is based off of pkg/provision/storage/CommonStorage_test.go with slight adaptions. It also ensures that the owner reference is set for the perWorkspace PVC, which is required for automatic PVC deletion with cluster garbage collection.

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

@openshift-ci
Copy link

openshift-ci bot commented Apr 13, 2022

Hi @AObuchow. Thanks for your PR.

I'm waiting for a devfile 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.

Copy link
Collaborator

@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.

First pass at review -- generally looks good!

I'll get around to deeper review and testing later.

docs/additional-configuration.adoc Outdated Show resolved Hide resolved
pkg/common/naming.go Outdated Show resolved Hide resolved
pkg/constants/constants.go Outdated Show resolved Hide resolved
samples/flattened_theia-next_perWorkspaceStorage.yaml Outdated Show resolved Hide resolved
pkg/provision/storage/shared.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage_test.go Outdated Show resolved Hide resolved
@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch from 8810b3f to 54e9f04 Compare April 13, 2022 21:51
pkg/constants/constants.go Outdated Show resolved Hide resolved
@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch 2 times, most recently from 53c8e9b to 51e660b Compare April 14, 2022 03:54
@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch from 51e660b to ba4c27b Compare April 14, 2022 15:44
@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch from ba4c27b to b2ee4e4 Compare April 19, 2022 15:46
@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch from b2ee4e4 to 8d65602 Compare April 19, 2022 15:50
@AObuchow AObuchow requested a review from amisevsk April 19, 2022 15:55
Copy link
Collaborator

@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.

Mostly just minor nitpicks and polish at this point. Well done!

Tested on OpenShift 4.10 and works as expected 👍

pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage.go Outdated Show resolved Hide resolved
pkg/provision/storage/perWorkspaceStorage_test.go Outdated Show resolved Hide resolved
pkg/provision/storage/shared.go Outdated Show resolved Hide resolved
@AObuchow
Copy link
Collaborator Author

Mostly just minor nitpicks and polish at this point. Well done!

Tested on OpenShift 4.10 and works as expected +1

Awesome, thank you so much for the help & reviews @amisevsk 😁
I made the requested changes.

@AObuchow AObuchow requested a review from amisevsk April 20, 2022 15:42
@openshift-ci openshift-ci bot added the lgtm label Apr 20, 2022
@amisevsk
Copy link
Collaborator

Well done 👍

@@ -90,6 +90,10 @@ func PVCCleanupJobName(workspaceId string) string {
return fmt.Sprintf("cleanup-%s", workspaceId)
}

func PerWorkspacePVCName(workspaceId string) string {
return fmt.Sprintf("storage-%s", workspaceId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Sprintf("storage-%s", workspaceId)
return fmt.Sprintf("claim-%s", workspaceId)

Comment on lines +158 to +159
// TODO: Determine the storage size that is needed by iterating through workspace volumes,
// adding the sizes specified and figuring out overrides/defaults
Copy link
Contributor

Choose a reason for hiding this comment

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

This TODO is planned to be addressed as part of #740, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct, or at the least, it might end up being a separate but related issue

@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch from dd4baca to 15b6705 Compare April 21, 2022 14:30
@openshift-ci openshift-ci bot removed the lgtm label Apr 21, 2022
@AObuchow AObuchow requested a review from ibuziuk April 21, 2022 14:53
Copy link
Contributor

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

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

Great job 👍

@AObuchow AObuchow force-pushed the one_pvc_per_workspace branch from 15b6705 to 7b89ee5 Compare April 22, 2022 16:21
@openshift-ci openshift-ci bot removed the lgtm label Apr 22, 2022
@amisevsk
Copy link
Collaborator

/test v8-devworkspace-operator-e2e, v8-che-happy-path

@AObuchow
Copy link
Collaborator Author

/retest

@openshift-ci
Copy link

openshift-ci bot commented Apr 25, 2022

@AObuchow: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@ibuziuk
Copy link
Contributor

ibuziuk commented Apr 26, 2022

/retest

@ibuziuk
Copy link
Contributor

ibuziuk commented Apr 26, 2022

I believe we can merge with the failed test
@musienko-maxim do you happen to know the state of the happy path?

@ibuziuk ibuziuk requested a review from musienko-maxim April 26, 2022 11:31
Copy link
Collaborator

@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.

We generally treat happy path as optional; the QE folks have had their plate full with other projects and its been unhealthy for a while now.

👍 to merge

@openshift-ci openshift-ci bot added the lgtm label Apr 26, 2022
@openshift-ci
Copy link

openshift-ci bot commented Apr 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@amisevsk
Copy link
Collaborator

/retest

@openshift-ci
Copy link

openshift-ci bot commented Apr 26, 2022

@AObuchow: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v8-che-happy-path 7b89ee5 link true /test v8-che-happy-path

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

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.

Support 'per-workspace' storage-class (one PVC per workspace)
3 participants