-
Notifications
You must be signed in to change notification settings - Fork 56
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
Allow pod/container overrides for volumes/volumemounts #1223
Conversation
Signed-off-by: David Kwon <[email protected]>
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.
Generally looks good, I have a few comments
Nice work 👍
pkg/library/overrides/testdata/container-overrides/container-defines-overrides-volumemount.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: David Kwon <[email protected]>
Thank you for the review @amisevsk , I've updated the PR |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1223 +/- ##
==========================================
- Coverage 52.74% 52.52% -0.22%
==========================================
Files 84 84
Lines 7616 7636 +20
==========================================
- Hits 4017 4011 -6
- Misses 3310 3333 +23
- Partials 289 292 +3 ☔ View full report in Codecov by Sentry. |
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.
LGTM 👍
Thanks @dkwon17!
pkg/library/overrides/testdata/container-overrides/overrides-can-define-volumemount.yaml
Outdated
Show resolved
Hide resolved
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, dkwon17 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 |
Regarding the merge key for volumeMounts being |
New changes are detected. LGTM label has been removed. |
@dkwon17 One somewhat annoying thing in this repo: all commits need a signoff before merge (including fixup commits that would be squashed when merging). You'll need to squash fixups manually (or sign off on them) before we can merge this PR. |
Co-authored-by: Angel Misevski <[email protected]> Signed-off-by: David Kwon <[email protected]>
d54fe8e
to
7f1f26f
Compare
@amisevsk I've squashed the GitHub fixup commits and signed it off.
I will make a PR to update the pod/container overrides documentation removing the mention about volume/mounts being non-overridable. Maybe I can add a sentence about not overriding default volumes/mounts? Nothing at the moment prevents a user from doing this however. |
That would be great -- even just a warning that you can override built-in volume mounts and should avoid doing it would be useful. |
What does this PR do?
Allows pod overrides for
spec.volumes
and container overrides forspec.containers[*].volumeMounts
.What issues does this PR fix or reference?
eclipse-che/che#22751
Is it tested? How?
Checkout this PR and install DWO on a fresh cluster with Run controller locally. Switch to the
devworkspace-controller
namespace by runningoc project devworkspace-controller
Mounting secrets to workspace container using overrides
secret-volume
in the list of volumes:tools
container:tools
container to check that the secret has been mounted:storage-type
toper-user
:storage-type
toper-workspace
, start the workspace and recheck steps 3-6 again.The feature also works for adding PVC volumes:
Caveat of this feature
When introducing a new volumes using pod-overrides, the new volume must contain all fields that Kubernetes may add. For example, pods that specify configmap and secret volumes have a
defaultMode: 420
added to the yaml even if it's not originally provided in the pod's yaml.Therefore when introducing a new configmap/secret volumes using pod-overrides, the
defaultMode
field must be provided along with the configmap/secret details.For example:
If the
defaultMode
is missing in the pod overrides, the DevWorkspace will never reach theRunning
state because the new volume in the pod will have thedefaultMode: 420
added by default. At the same time, the DWO will try to removedefaultMode
if it doesn't exist in pod overrides. To clarify, from my testing this only happens when introducing new volumes through pod-overrides. This logic causes reconciliation until workspace start fails with this message:PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che