Skip to content

guest: unify pod model for V1, virtual pod, and V2 shim support#2662

Closed
shreyanshjain7174 wants to merge 2 commits intomicrosoft:mainfrom
shreyanshjain7174:guest-pod-unification
Closed

guest: unify pod model for V1, virtual pod, and V2 shim support#2662
shreyanshjain7174 wants to merge 2 commits intomicrosoft:mainfrom
shreyanshjain7174:guest-pod-unification

Conversation

@shreyanshjain7174
Copy link
Copy Markdown
Contributor

@shreyanshjain7174 shreyanshjain7174 commented Apr 6, 2026

Superseded — will rewrite as a fresh PR on top of merged #2653 (main). The old branch had too many conflicts with recent main changes to rebase cleanly.

@shreyanshjain7174 shreyanshjain7174 requested a review from a team as a code owner April 6, 2026 10:09
Replace heuristic sandbox path derivation (hard-coded /run/gcs/c prefix + ID)
with host-provided OCIBundlePath as the canonical sandbox root directory.

This change prepares the guest-side GCS for Shim v2 and multi-pod UVM support,
where the host may use a different path layout than the legacy /run/gcs/c/<id>.

Key changes:
- Add sandboxRoots mapping on Host to store resolved sandbox root per sandbox ID
- Sandbox containers: register OCIBundlePath as sandbox root
- Virtual pods: derive sandbox root from OCIBundlePath parent + /virtual-pods/<id>
- Workload containers: resolve sandbox root from Host mapping (fallback to legacy)
- Standalone containers: use OCIBundlePath directly as root
- Container.Delete: use stored sandboxRoot for cleanup paths
- Remove duplicate setup functions (setupVirtualPod* merged into unified setup*)

The refactor produces identical paths when the old shim sends OCIBundlePath in
the legacy format, ensuring zero behavior change for existing deployments.

Security: virtualPodID is validated against path traversal before use.
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
Replace VirtualPod with a generic uvmPod struct that serves all three
sandbox modes (V1 shim, virtual pod annotation, V2 native Sandbox API).

Key changes:
- VirtualPod (exported, complex) -> uvmPod (unexported, simpler)
- Host.virtualPods/containerToVirtualPod/virtualPodsCgroupParent -> Host.pods
- createPodInUVM: unified pod creation under /pods/<sandboxID> cgroup
- Container.sandboxID: every container tracks its sandbox for cleanup
- RemoveContainer: uses sandboxID + pod lookup instead of annotation checks
- Cgroup layout: /pods/<sandboxID>/<containerID> for all CRI containers
- cmd/gcs/main.go: /containers/virtual-pods cgroup -> /pods cgroup
- Remove InitializeVirtualPodSupport and all VirtualPod management methods

Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants