feat: add E2B-compatible volume management APIs#550
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
Welcome @princexpoddar! It looks like this is your first PR to openkruise/agents 🎉 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #550 +/- ##
==========================================
+ Coverage 79.66% 79.77% +0.11%
==========================================
Files 194 197 +3
Lines 13772 14144 +372
==========================================
+ Hits 10971 11284 +313
- Misses 2403 2448 +45
- Partials 398 412 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Prabal Poddar <prabalpoddar73@gmail.com>
7d8359d to
e098607
Compare
|
Hello @furykerry @AiRanthem @zmberg , |
Ⅰ. Describe what this PR does
Closes #505
This PR adds E2B-compatible volume management APIs to
sandbox-managerand introduces support for mounting registered volumes during sandbox creation.Key changes
Volume APIs
Adds the following E2B-compatible endpoints:
/volumes/volumes/volumes/{volumeID}/volumes/{volumeID}These routes are also available under the configured E2B API prefix through the existing
RegisterE2BRoutemechanism.Sandbox volume mounts
Adds a new optional field to
POST /sandboxes:{ "templateID": "my-template", "volume_mounts": [ { "volumeID": "pv-001", "mountPath": "/data", "readOnly": false } ] }Each volume reference is resolved into a
CSIMountConfigand injected into the existing CSI mount pipeline. No changes were required to the claim/clone workflow.Storage model
This implementation follows maintainer feedback and uses existing Kubernetes
PersistentVolumeobjects directly rather than introducing a new CRD.Registered volumes are represented by PVs labeled with:
agents.kruise.io/volume-owner-namespaceagents.kruise.io/volume-namevolumeIDmaps directly to the PV name.Mounted-volume detection
Volume usage is derived from
SandboxClaim.spec.dynamicVolumesMountinstead of maintaining mount state on the PV. This avoids duplicated state and eliminates stale annotation cleanup concerns.Observability
Adds Prometheus metrics:
volume_operation_totalvolume_operation_duration_secondsfor register, list, get, and delete operations.
Ⅱ. Does this pull request fix one issue?
Closes #505
Ⅲ. Describe how to verify it
Unit tests
Integration tests
Build verification
Ⅳ. Special notes for reviewers
No CRDs or API types were added.
RegisterVolumeandDeleteVolumeread PVs directly from the API server to avoid acting on stale cache data.ListVolumesandGetVolumeuse the informer cache.Cross-namespace access returns
404 Not Foundrather than403 Forbiddento avoid information disclosure.resolveVolumeMountsreusesGetVolume, ensuring namespace isolation is enforced consistently for both volume APIs and sandbox creation.Mounted-volume checks are derived from
SandboxClaim.spec.dynamicVolumesMount; no mount state is stored on PVs.The implementation is fully additive and does not modify existing CSI mount behavior.
Build verification completed successfully for all packages modified by this PR: