Skip to content

Conversation

@AObuchow
Copy link
Collaborator

@AObuchow AObuchow commented Apr 26, 2022

What does this PR do?

  • Allows for (optionally) configuring the default PVC size for common and per-workspace storage classes using DevWorkspaceOperatorConfig CRD
  • Sets default PVC sizes for common/async and per-workspace storage classes

In order to configure the default PVC size for a storage class, a DevWorkspaceOperatorConfig CRD must be applied to the cluster with the DefaultStorageSize workspace property set. This property takes a struct where the resource.Quantity fields define the PVC sizes for common/async and per-workspace storage classes.

What issues does this PR fix or reference?

Fix #792.

Is it tested? How?

  • Manual testing of PVC size defaults has been done by starting up a cluster, applying a devfile that uses the controller.devfile.io/storage-type attribute set to per-workspace and verifying the newly created PVC size is set to the default size for per-workspace storage.
    • Manually testing the default PVC size for common storage still needs to be done, however the "new" default is currently the same as it used to be (10Gi)
  • The commonStorage test has been modified to support this new change. Both the common and per-workspace storage class tests are passing with this new change.
  • The sync tests have been modified to support this new change.

Additional WIP notes

  • Setting the storage class sizes with a CRD still needs to be manually tested

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 26, 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.

Details

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.

@AObuchow AObuchow force-pushed the configurable_default_pvc_size branch from 00bb54c to 30d5d73 Compare April 26, 2022 14:25
@amisevsk
Copy link
Collaborator

You'll need to rebase onto main (dropping the first commit)

@AObuchow AObuchow force-pushed the configurable_default_pvc_size branch from 30d5d73 to 7266ce6 Compare April 26, 2022 21:56
x-kubernetes-int-or-string: true
description: 'StorageClassSize defines an optional map of sizes
of persistent volume claims for each storage class used by DevWorkspaces.
The available keys to the map are: "common", "per-workspace".
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure why these files don't have the mention of async using the common storage class PVC size that I added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The CI is also complaining about this :P

Copy link
Collaborator

Choose a reason for hiding this comment

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

You have to run make generate to regenerate CRDs after changing the go definition. I use

make generate manifests fmt generate_default_deployment generate_olm_bundle_yaml

to make sure all autogenerated files are in sync.

@AObuchow
Copy link
Collaborator Author

I opened che-server and built it on the dog fooding cluster, then checked the workspace's associated PVC usage from the OpenShift dashboard.

I also made sure that any other workspace I had (other than che-server) was deleted.

It says 545.4 MiB were used:
image

@AObuchow
Copy link
Collaborator Author

I opened che-code and built it on the dog fooding cluster.

After initial workspace setup (git clone and plugins, which were automatically setup), disk usage was 981.3MiB.
After running yarn prepare, disk usage was just under 3GiB (2.7GiB IIRC)
After running yarn build, disk usage is 3.39GiB.
Finally, I ran yarn watch and in another terminal, yarn server which brought up the disk usage to 3.49GiB
image

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.

After some discussion with Andrew, we've decided that it makes more sense to define the default storage size configuration fields as a struct rather than map[string]string. This will allow for better documentation and easier validation (since we can rely on the k8s API).

@amisevsk
Copy link
Collaborator

I'm 👍 on setting the default per-workspace storage size to 5Gi to be on the safe side (4Gi isn't much wiggle room for a project like che-code). One of the benefits of this PR is that these defaults become configurable, so we should aim for something that always works as a default, even if it overprovisions storage in most cases.

@AObuchow AObuchow requested a review from amisevsk April 29, 2022 16:53
@AObuchow
Copy link
Collaborator Author

AObuchow commented May 2, 2022

Not sure yet why the check sources CI is suddenly failing:

go: downloading golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba
Error: ../../../go/pkg/mod/golang.org/x/tools@v0.1.10/cmd/goimports/goimports.go:14:2: //go:build comment without // +build comment
Error: Process completed with exit code 1.

@amisevsk
Copy link
Collaborator

amisevsk commented May 3, 2022

#831 should fix PR check

@AObuchow AObuchow changed the title WIP: Configurable default PVC size for common and per-workspace storage classes Configurable default PVC size for common and per-workspace storage classes May 4, 2022
@AObuchow AObuchow marked this pull request as ready for review May 9, 2022 22:01
@AObuchow AObuchow requested a review from ibuziuk as a code owner May 9, 2022 22:01
Comment on lines 295 to 298
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.%s=%s", constants.CommonStorageClassType, Workspace.DefaultStorageSize.Common.String()))
}
if Workspace.DefaultStorageSize.PerWorkspace != nil {
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.%s=%s", constants.PerWorkspaceStorageClassType, Workspace.DefaultStorageSize.PerWorkspace.String()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should hard-code the config names, this will result in logging e.g.

workspace.defaultStorageSize.per-workspace=5Gi

even though the actual config field is

workspace.defaultStorageSize.perWorkspace
Suggested change
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.%s=%s", constants.CommonStorageClassType, Workspace.DefaultStorageSize.Common.String()))
}
if Workspace.DefaultStorageSize.PerWorkspace != nil {
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.%s=%s", constants.PerWorkspaceStorageClassType, Workspace.DefaultStorageSize.PerWorkspace.String()))
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.common=%s", Workspace.DefaultStorageSize.Common.String()))
}
if Workspace.DefaultStorageSize.PerWorkspace != nil {
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.perWorkspace=%s", Workspace.DefaultStorageSize.PerWorkspace.String()))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good, I went with per-workspace instead of perWorkspace. Let me know if you rather it be perWorkspace

Copy link
Collaborator

Choose a reason for hiding this comment

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

It should match the actual field in the config though -- the dot delimited format is meaningful here. If you try to set workspace.defaultStorageSize.per-workspace in the DevWorkspaceOperatorConfig, it will be invalid.

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.

@AObuchow could you please resolve the conficts?

@AObuchow
Copy link
Collaborator Author

@AObuchow could you please resolve the conficts?

Sorry about that - will be done in a moment.

@AObuchow AObuchow force-pushed the configurable_default_pvc_size branch from 57f4be1 to c2aa8d0 Compare May 18, 2022 15:02
@AObuchow AObuchow requested a review from ibuziuk May 18, 2022 15:08
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.

LGTM 👍

config = append(config, fmt.Sprintf("workspace.defaultStorageSize.common=%s", Workspace.DefaultStorageSize.Common.String()))
}
if Workspace.DefaultStorageSize.PerWorkspace != nil {
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.per-workspace=%s", Workspace.DefaultStorageSize.PerWorkspace.String()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.per-workspace=%s", Workspace.DefaultStorageSize.PerWorkspace.String()))
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.perWorkspace=%s", Workspace.DefaultStorageSize.PerWorkspace.String()))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done :) Will autosquash when ready for merge

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be good for merge assuming nothing else needs to be changed 😎

@openshift-ci openshift-ci bot removed the lgtm label May 25, 2022
@AObuchow AObuchow force-pushed the configurable_default_pvc_size branch from ae1cfd2 to 3932e90 Compare May 25, 2022 14:29
AObuchow added 3 commits May 25, 2022 10:36
Both common and per-workspace storage class PVC sizes can be configured through CRD's

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Part of devfile#740

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Fix devfile#836

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
@AObuchow AObuchow force-pushed the configurable_default_pvc_size branch from 3932e90 to ac607df Compare May 25, 2022 14:36
@openshift-ci openshift-ci bot added the lgtm label May 25, 2022
@openshift-ci
Copy link

openshift-ci bot commented May 25, 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

Details 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

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