-
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
Disable automount resources for the init-container-home
init container
#1273
Conversation
Skipping CI for Draft Pull Request. |
cd920bc
to
1a5164c
Compare
Hello @AObuchow could you please take a look? I just want to make sure the code is OK before I add new tests |
} | ||
} | ||
return initContainers | ||
} |
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.
Setting the init-persistent-home
initcontainer to the front is necessary because if there is another initcontainer that runs before it, the automount resource can mount within /home/user
and cause stow conflicts in init-persistent-home
since the mounted configmap file would be saved in the PVC.
Basically, this function is here to have a way to ensure that init-persistent-home
is the first initcontainer that runs, running before initcontainers like che-code-injector
and project-clone
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.
Thank you for the clarification, makes sense to me. It's probably worth leaving a similar comment explaining this in the code.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1273 +/- ##
==========================================
+ Coverage 52.52% 52.84% +0.32%
==========================================
Files 84 84
Lines 7642 7864 +222
==========================================
+ Hits 4014 4156 +142
- Misses 3335 3408 +73
- Partials 293 300 +7 ☔ 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.
@dkwon17 looks great to me so far :) I think you're good to go ahead and add tests 🙏
@dkwon17 In the testing instructions, you said to grep for |
@AObuchow sorry that was a mistake, it should be |
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.
Tested on OpenShift 4.15 & works as expected.
Looks good to me in its current state. Left some minor comments for consideration, but they are just suggestions. Great work @dkwon17 🥳!
cmp.Diff(tt.Output.EnvFrom, container.EnvFrom, testDiffOpts)) | ||
} | ||
|
||
for _, container := range podAdditions.InitContainers { |
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.
Somewhat redundant since it's already implicitly being checked in the preStart event test, but we could also explicitly check that the first container in the podAdditions.initContainers[]
is the init-persistent-home
initContainer (since this is a change introduced in this PR).
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 wasn't able to do that check here because the function that the this test is for:
err := ProvisionAutoMountResourcesInto(podAdditions, testAPI, testNamespace, true) |
doesn't reorder the initcontainers
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.
My mistake, makes sense 👍
@dkwon17 also before merging please squash your fixup commits & mention in the "Add test" commit that the tests are related to automount functionality with home persistence. |
d804278
to
9874cd4
Compare
…tainer if persistent home is enabled Fix devfile#1257 Disabling automount resources for the init-persistent-home initconatiner is done to avoid possible stow conflicts which can be introduced by automount resources. Signed-off-by: David Kwon <[email protected]>
Signed-off-by: David Kwon <[email protected]>
9874cd4
to
f83b0ba
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.
LGTM 👍 Great job @dkwon17 :)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AObuchow, dkwon17, 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 |
What does this PR do?
Disable automount resources for the
init-persistent-home
initcontainer (an not the other initcontainers) if persistent home is enabled.What issues does this PR fix or reference?
#1257
Is it tested? How?
devworkspace-operator-config
, enable persistent storage.init-persistent-home
, and that the configmap is mounted in all containers except forinit-persistent-home
:dev
container: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