Skip to content

guest/spec: remove VirtualPod path helpers and dead code#2700

Open
shreyanshjain7174 wants to merge 2 commits intomicrosoft:mainfrom
shreyanshjain7174:guest-cleanup-virtual-pod
Open

guest/spec: remove VirtualPod path helpers and dead code#2700
shreyanshjain7174 wants to merge 2 commits intomicrosoft:mainfrom
shreyanshjain7174:guest-cleanup-virtual-pod

Conversation

@shreyanshjain7174
Copy link
Copy Markdown
Contributor

Depends on #2699 — must merge first.

Removes 13 VirtualPod-specific path helpers from internal/guest/spec/spec.go that became dead code after the pod unification in #2699. All callers now use the *FromRoot variants added in #2653.

Removed functions: VirtualPodRootDir, VirtualPodMountsDir, VirtualPodTmpfsMountsDir, VirtualPodHugePagesMountsDir, and all seven VirtualPodAware* selection/mount-source functions. Also removes SandboxLogsDir and SandboxLogPath — both were only reachable through VirtualPodAwareSandboxRootDir.

Updates ExtendPolicyWithNetworkingMounts in pkg/securitypolicy to accept a sandboxRoot string and call GenerateWorkloadContainerNetworkMountsFromRoot instead of the old ID-based variant.

No behavioral change — the same paths are produced, just through *FromRoot helpers that take a resolved root directory instead of deriving it from a hardcoded prefix + ID.

Shreyansh Sancheti added 2 commits April 22, 2026 11:42
Replace the separate VirtualPod tracking (dedicated type, 7 exported
methods, parent cgroup manager, reverse-lookup map) with a unified
uvmPod type and a single pods map on Host. All pod types (V1 sandbox,
virtual pod, V2 shim) now go through the same code path:

- createPodInUVM allocates a cgroup under /pods/{sandboxID}
- addContainerToPod tracks container→pod membership
- RemoveContainer handles cleanup uniformly

Cgroup hierarchy changes from:
  /containers/{id}                           (V1 sandbox)
  /containers/virtual-pods/{virtualPodID}    (virtual pod)
to:
  /pods/{sandboxID}                          (all pod types)

Workload containers nest under their pod:
  /pods/{sandboxID}/{containerID}

Signed-off-by: Shreyansh Jain <shreyanshjain7174@gmail.com>
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
Remove 13 VirtualPod-specific path functions from spec.go that became
dead code after the pod unification in the parent commit. All callers
now use the *FromRoot variants introduced in microsoft#2653.

Also removes SandboxLogsDir and SandboxLogPath — both were only
reachable through VirtualPodAwareSandboxRootDir which is now gone.

Updates ExtendPolicyWithNetworkingMounts in pkg/securitypolicy to
accept a sandboxRoot string and use GenerateWorkloadContainerNetworkMountsFromRoot.

Signed-off-by: Shreyansh Jain <shreyanshjain7174@gmail.com>
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.

1 participant