Conversation
|
Hi @SAY-5. 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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR moves volume mount rewriting into a shared helper. Common storage supplies workspace-prefixed subpaths. Per-workspace storage supplies volume-name subpaths. ChangesVolume mount rewrite refactor
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk is identified; the change is mergeable after normal checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/che-ai-assistant ok-pr-review Task completed. |
tolusha
left a comment
There was a problem hiding this comment.
Reviewed the refactor against the base branch rather than by eye, and it holds up well.
Verification
I diffed the two original function bodies at 5684f19 against each other: they differ only in the receiver type and the single SubPath line, so the premise of #1697 is accurate and no hidden drift between the copies was flattened. I then diffed the original CommonStorageProvisioner body against the new shared.go:349-428: the only differences are the added subPathFunc parameter and SubPath = subPathFunc(workspaceId, vm.Name) replacing the inline fmt.Sprintf.
So the subpath format is byte-identical for both strategies. Existing workspaces keep their data at the same paths, and no migration or coordinated rollout is needed. I also checked that AsyncStorageProvisioner does not contain a third copy of this logic, so leaving it alone is right.
Test coverage is stronger than the description suggests, which is what makes this safe: both suites compare the entire PodAdditions struct with assert.Equal plus cmp.Diff, so SubPath values are verified exactly rather than just checked for existence. Both error branches are covered on both strategies, for containers and init containers.
A few things worth calling out
- The
// TODO: What should we do when a volume isn't explicitly defined?was carried over verbatim rather than quietly resolved. Answering open questions inside a mechanical refactor is a common way to bury a semantic change, so this is the disciplined choice. - Every original comment survived byte-identical and in position, and no new commentary was added to the moved code. The only new prose is the doc comment on the new function, and it explains why the callback exists rather than restating the signature.
- The now-unused
constants/devfileConstantsimports were actually removed from both provisioner files.
Two non-code items before merge
- No compiling check has run on this branch. CodeRabbit, DCO, WIP and the two Snyk checks are all non-compiling (Snyk reports "No manifest changes detected"), and the
needs-ok-to-testlabel means Prow has not rungo buildorgo test. That matters here because the PR removes imports, which is a compile-time failure in Go. I traced the remaining usages by hand and they look correct, but could a devfile member drop an/ok-to-testso the compiler confirms it on the merge commit? - The CodeRabbit-generated release notes in the description file this under Bug Fixes ("Ensured non-ephemeral volume mounts consistently map to the appropriate PVC subpaths"). This is a pure refactor with no behaviour change. Would you mind correcting that section so it does not reach a changelog as a fix?
Two optional nits
- Both
rewriteContainerVolumeMountsmethods are now one-line delegations, are not part of theProvisionerinterface, and have one caller each. They still earn their keep through the per-strategy doc comments, so keeping them is fine - just worth being a deliberate choice rather than a leftover of the extraction. shared.gostill readsCopyright (c) 2019-2025while the two files it absorbed code from read2019-2026.addlicense -checkonly verifies presence, so CI will not catch it.
Nice, tightly scoped first contribution. Nothing here blocks merge.
| } | ||
|
|
||
| // Containers in podAdditions may reference volumes defined in pod overrides, and this is not an error | ||
| overridesVolumes, err := overrides.GetVolumesFromOverrides(workspace, restrictedFields) |
There was a problem hiding this comment.
Not a change request, just noting it while the context is fresh.
This branch has no test coverage. I checked every fixture under testdata/common-storage/ and testdata/perWorkspace-storage/ and none of them define pod overrides, so GetVolumesFromOverrides returns an empty map in every test and the additionalVolumes[vm.Name] escape below is never reached via the overrides path.
The gap is pre-existing and should not block this PR. Worth mentioning because the extraction makes it cheaper to close: it used to need two fixtures kept in sync, now a single one covers both strategies. Does it make sense to add one as a follow-up?
There was a problem hiding this comment.
Yeah, a single pod-overrides fixture should cover both strategies now. I can do that as a follow-up.
|
Also bumped the copyright year in shared.go and moved the release notes out of Bug Fixes since it's a pure refactor. |
…torage provisioners Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
5e8c72b to
10465bd
Compare
|
Rebased onto main. #1693 moved those call sites to |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rohanKanojia, SAY-5, tolusha The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/retest |
1 similar comment
|
/retest |
What does this PR do?
Extracts the duplicated
rewriteContainerVolumeMountslogic fromCommonStorageProvisionerandPerWorkspaceStorageProvisionerinto a single shared function inshared.go. The two provisioner methods were ~80 lines of nearly identical code that differed only in how the volume mountSubPathis computed, so the shared function takes asubPathFuncparameter and each provisioner passes its own strategy (workspace-id-prefixed for common, bare volume name for per-workspace).What issues does this PR fix or reference?
Fixes #1697
Is it tested? How?
Existing unit tests for both storage provisioners (
commonStorage_test.go,perWorkspaceStorage_test.go) pass unchanged:go test ./pkg/provision/storage/....PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-pathto trigger)v8-devworkspace-operator-e2e: DevWorkspace e2e testv8-che-happy-path: Happy path for verification integration with CheRelease notes
Refactored the shared volume-mount logic without changing provisioning behavior.