-
Notifications
You must be signed in to change notification settings - Fork 61
Add automount functionality for PVCs #544
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
Conversation
b8086e3
to
ef738fd
Compare
ef738fd
to
3b04f82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested but changes seem to be pretty straightforward
controllers/workspace/finalize.go
Outdated
"github.com/go-logr/logr" | ||
coputil "github.com/redhat-cop/operator-utils/pkg/util" | ||
corev1 "k8s.io/api/core/v1" | ||
k8sErrors "k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/types" | ||
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had a bit of trouble with this since we're having some aliasing issues 😄
- Can't use
workspace
as we name the DevWorkspace instance that provision
isn't ideal since it's completely unrelated to the package (as you point out)workspaceprovision
is 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with any
pkg/provision/storage/cleanup.go
Outdated
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDE's footprint is found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Needs 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Add annotation 'controller.devfile.io/read-only' to enable automounting PVCs with read-only access. Signed-off-by: Angel Misevski <[email protected]>
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 <[email protected]>
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. 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. |
What does this PR do?
Adds the ability to mount PVCs to all DevWorkspaces by applying the
controller.devfile.io/mount-to-devworkspace
label (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/provision
topkg/provision/workspace
so that all "provisioning" code is in same placecontrollers/workspace/env
intopkg/provision/workspace
andpkg/constants
pkg/provision/workspace/automount
What 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
/testing
If 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-path
to trigger)v7-devworkspaces-operator-e2e
: DevWorkspace e2e testv7-devworkspace-happy-path
: DevWorkspace e2e test