Add automount functionality for PVCs#544
Conversation
b8086e3 to
ef738fd
Compare
ef738fd to
3b04f82
Compare
sleshchenko
left a comment
There was a problem hiding this comment.
I haven't tested but changes seem to be pretty straightforward
| "sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
|
|
||
| "github.com/devfile/devworkspace-operator/pkg/provision/storage" | ||
| provision "github.com/devfile/devworkspace-operator/pkg/provision/workspace" |
There was a problem hiding this comment.
really minor. Maybe it makes sense to drop provision alias, or make it wsProvision to avoid confusion with provision/storage...
There was a problem hiding this comment.
Yeah, I had a bit of trouble with this since we're having some aliasing issues 😄
- Can't use
workspaceas we name the DevWorkspace instance that provisionisn't ideal since it's completely unrelated to the package (as you point out)workspaceprovisionis too long
I think wsprovision makes sense. I'll update the PR -- do we want to settle on wsProvision or wsprovision? We kind of use both (k8serrors vs k8sErrors) but I think the standard is all-lowercase.
| "github.com/devfile/devworkspace-operator/pkg/common" | ||
| "github.com/devfile/devworkspace-operator/pkg/config" | ||
| "github.com/devfile/devworkspace-operator/pkg/constants" | ||
| workspace2 "github.com/devfile/devworkspace-operator/pkg/provision/workspace" |
There was a problem hiding this comment.
I just wish it would warn me it was doing this 😄
Thanks for catching it.
3b04f82 to
5ed1840
Compare
5ed1840 to
4f4af21
Compare
|
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, JPinkney, sleshchenko The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
New changes are detected. LGTM label has been removed. |
020af58 to
33d4fb3
Compare
Move all provisioning code (i.e. code that creates resources on-cluster) to the same place Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Split common env var package to merge it into existing pkg/ structure: * Constants (env var names) to pkg/constants/env.go * Function providing common env vars to pkg/provision/workspace to sit alongside alongside where it's used. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Since we're adding more features to automounting, it makes sense to move functionality for getting configmaps/secrets/pvcs to a separate package from workspace provisioning. This commit splits the only large automount file into files for common functionality, managing secrets, and managing configmaps Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Add ability to automatically mount PVCs to DevWorkspace pods based on the automount label. Automounted PVCs require a mountPath specified via the mount-path annotation. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Add annotation 'controller.devfile.io/read-only' to enable automounting PVCs with read-only access. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
This is a really annoying change to make, since 1. VS Code will remove "unused" imports and reimport the unaliased package name on save, *even* if you use find-replace 2. Goland will let you refactor the import alias, but will basically find-replace throughout the file to do so, meaning that "workspace" gets replaced with "wsprovision" *in comments*. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
33d4fb3 to
449fd7f
Compare
|
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
|
@amisevsk: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
What does this PR do?
Adds the ability to mount PVCs to all DevWorkspaces by applying the
controller.devfile.io/mount-to-devworkspacelabel (similarly to configmaps/secrets). PVCs are mounted to the path specified bycontroller.devfile.io/mount-path, or/tmp/<claim-name>if annotation is not present.PVCs can be mounted read-only (to support read-only-many volumes)
The first three commits in this PR are just moving stuff around to make things sensible:
controllers/workspace/provisiontopkg/provision/workspaceso that all "provisioning" code is in same placecontrollers/workspace/envintopkg/provision/workspaceandpkg/constantspkg/provision/workspace/automountWhat issues does this PR fix or reference?
Closes #503
Is it tested? How?
Create a PVC on your cluster, e.g.
and create a DevWorkspace. PVC should be mounted to
/testingIf mounted read-write, try creating a file there, stopping the current workspace, and creating a new one.
PR Checklist
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-pathto trigger)v7-devworkspaces-operator-e2e: DevWorkspace e2e testv7-devworkspace-happy-path: DevWorkspace e2e test