Skip to content

[Proposal] add sandbox-pool management proposal#431

Open
lichuqiang wants to merge 1 commit into
volcano-sh:mainfrom
lichuqiang:main
Open

[Proposal] add sandbox-pool management proposal#431
lichuqiang wants to merge 1 commit into
volcano-sh:mainfrom
lichuqiang:main

Conversation

@lichuqiang

@lichuqiang lichuqiang commented Jul 9, 2026

Copy link
Copy Markdown

What type of PR is this?

/kind feature

What this PR does / why we need it:

As discussed in #430, the current agentcube architecture has limitations in certain scenarios. To break through the
bottlenecks of the Kubernetes architectural paradigm in workload startup speed and managed resource scale, we envision an architectural evolution of agentcube that establishes a dual fast/slow resource track. The slow track builds sandbox resource pool
management capabilities on top of the Kubernetes CRD framework, supporting the partitioning of resources on K8s nodes as resource pools for sandbox execution. In parallel, a lightweight, fast, Kubernetes-independent sandbox lifecycle management platform is
established to achieve more extreme performance and a larger management scale.

This proposal focuses on the slow track. The system implements declarative management of sandbox resources through a two-layer architecture:

  • Global Policy Layer (SandboxPool Controller): Responsible for Class → Pool mapping, node selection, policy snapshot
    synchronization, and Phase aggregation.
  • Node Execution Layer (placeholder-agent): Acts as the node-local agent, responsible for resource policy enforcement, watermark
    checking, and status reporting.

Core capabilities include:

  • Providing declarative CRD APIs (SandboxPoolClass + SandboxPool) to manage node-level sandbox resource pools
  • Reliably locking scheduled resources through the Static Pod model, with automatic mirror pod rebuild in < 5s upon accidental
    deletion
  • Supporting VPA InPlaceResize for online adjustment of placeholder Pod resources without Pod recreation

Integrated with the fast-track data plane, this ultimately enables co-location of regular Pods and sandboxes on the same node.

Which issue(s) this PR fixes:
Refs #430

Does this PR introduce a user-facing change?:
Architecture evolution

Copilot AI review requested due to automatic review settings July 9, 2026 01:58
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hzxuzhonghu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

Welcome @lichuqiang! It looks like this is your first PR to volcano-sh/agentcube 🎉

@lichuqiang

Copy link
Copy Markdown
Author

/cc @RainbowMango

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a design proposal for SandboxPool Resource Pool Management, which outlines a two-layer architecture to declaratively manage and elastically scale node-level sandbox resource pools. Feedback on the proposal includes fixing a markdown rendering issue with un-opened code blocks, using resource.Quantity instead of string for CPU and memory fields to align with Kubernetes API standards, and refining the state machine logic to ensure all node conditions are re-evaluated when a node is recovered rather than unconditionally transitioning to a Ready state.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new design proposal documenting the “slow track” SandboxPool resource pool management architecture, intended to address AgentCube’s current Kubernetes control-plane bottlenecks (startup latency and scale) discussed in #430.

Changes:

  • Introduces a new proposal document describing a two-layer SandboxPool architecture (controller + node-local placeholder-agent).
  • Defines proposed CRD data models (SandboxPoolClass/SandboxPool), status/conditions ownership (SSA FieldOwner), and a phase state machine.
  • Documents operational flows (create/update/delete), RBAC, webhook validation rules, and a phased implementation plan.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
@codecov-commenter

codecov-commenter commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.50%. Comparing base (3b19390) to head (3d1bd0d).
⚠️ Report is 21 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #431      +/-   ##
==========================================
+ Coverage   58.41%   58.50%   +0.08%     
==========================================
  Files          36       36              
  Lines        3463     3463              
==========================================
+ Hits         2023     2026       +3     
+ Misses       1231     1228       -3     
  Partials      209      209              
Flag Coverage Δ
unittests 58.50% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings July 9, 2026 02:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
Copilot AI review requested due to automatic review settings July 9, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread docs/proposals/sandbox-pool-management/README.md
@ranxi2001

Copy link
Copy Markdown
Contributor

Could this PR use Refs #430 instead of Fixes #430?

My understanding is that #430 is a broader architecture discussion, while this proposal focuses on the slow resource track / SandboxPool management. Using Fixes #430 would close the discussion when this PR is merged, which may be too early if the fast-track lifecycle pieces remain out of scope.

@vivek41-glitch

Copy link
Copy Markdown
Contributor

@lichuqiang please commit signoff statement too , dco also failling

@vivek41-glitch

Copy link
Copy Markdown
Contributor

Could this PR use Refs #430 instead of Fixes #430?

My understanding is that #430 is a broader architecture discussion, while this proposal focuses on the slow resource track / SandboxPool management. Using Fixes #430 would close the discussion when this PR is merged, which may be too early if the fast-track lifecycle pieces remain out of scope.

abso , this is discussion issue not a bug or need to fix , u should first purpose and discuss then open pr @lichuqiang

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
@acsoto

acsoto commented Jul 9, 2026

Copy link
Copy Markdown
Member

I want to better understand the relationship with the existing agent-sandbox WarmPool path. Today CodeInterpreter.warmPoolSize uses SandboxTemplate/SandboxWarmPool/SandboxClaim to pre-create session-level sandboxes. This proposal seems to introduce a node-level resource pool for the new decoupled path. Are these intended to coexist as separate modes, or is SandboxPool expected to become the lower layer that eventually replaces the current WarmPool path?

| Risk | Impact | Mitigation |
|------|--------|-----------|
| Phase update delay (≤30s) | Delay between Conditions change and Phase update | Alert rule sets `for ≥ 1m` buffer to avoid flapping |
| Conditions stuck at stale values when placeholder-agent unreachable | Phase may not reflect latest state | NodeNotFound covers node deletion; long unreachability causes Node to become NotReady, indirectly covering |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one question about this stale-status mitigation.

My reading is that placeholder-agent owns the node-local conditions and patches status every 30s, while the controller owns phase and NodeNotFound. If the Kubernetes Node still exists but placeholder-agent has stopped or can no longer patch status, the last successful PlaceholderPodReady=True / NodeCtlHealthy=True values may stay in status.

Could the proposal make the stale-status rule explicit for that case? For example, should the controller derive Degraded / Unready from a lastHeartbeat timeout, Node readiness, condition timestamps, or a controller-owned PlaceholderAgentHealthy condition?

This would make the phase aggregation and fault-injection tests clearer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. Updated related content

@lichuqiang

Copy link
Copy Markdown
Author

I want to better understand the relationship with the existing agent-sandbox WarmPool path. Today CodeInterpreter.warmPoolSize uses SandboxTemplate/SandboxWarmPool/SandboxClaim to pre-create session-level sandboxes. This proposal seems to introduce a node-level resource pool for the new decoupled path. Are these intended to coexist as separate modes, or is SandboxPool expected to become the lower layer that eventually replaces the current WarmPool path?

@acsoto The topic discussed in issue 430 and the current agentcube implementation represent more of a two-generation architecture relationship.
In the new architecture, to significantly improve sandbox startup efficiency and management scale, we will build an independent, lighter-weight, and higher-performance sandbox control plane (the so-called "fast resource").
Sandboxes will no longer be deployed as Pods, and therefore Kubernetes nodes cannot be directly used to run sandboxes. This requires a upfront sandbox resource pool management system (the so-called"slow resource") — which is what is being designed here. It can be thought of as a prerequisite resource preparation step for sandbox deployment.
What SandboxTemplate/SandboxClaim resource models correspond to is the related content of the fast resource system.

Copilot AI review requested due to automatic review settings July 9, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
| ValidatingWebhook | 1.16 GA | None |
| CRD v1 | 1.16 GA | None |
| SSA FieldOwner | 1.18 GA | None |
| VPA InPlaceResize | 1.27 Alpha / 1.31 GA | FeatureGate: InPlacePodVerticalScaling |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the compatibility assumption here needs clarification because the proposal combines two behaviors that the native Kubernetes resize path does not currently support together.

The proposal makes both Static Pod resource locking and no-rebuild VPA InPlaceResize part of the v1alpha1 core scope. However, Kubernetes KEP-1287 explicitly lists "The pod is a static pod" as an Infeasible in-place resize case. Its metadata records v1.27 alpha, v1.33 beta, and v1.35 stable, rather than v1.31 GA.

Could the proposal clarify which mechanism Phase 3 intends to use?

  • Native Kubernetes /resize: Static Pods are unsupported.
  • Local Static Pod manifest update: if kubelet rebuilds the Pod, this is not a no-rebuild resize, and the resource-locking behavior during replacement needs to be defined.
  • A custom placeholder-agent / runtime path: could the proposal describe how Kubernetes-visible requests, mirror Pod state, and node-ctl's actual limits remain consistent, instead of treating it as the native InPlacePodVerticalScaling path?

This distinction changes the compatibility table, implementation contract, and e2e acceptance criteria.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right — "VPA" here is more of an analogy, and should not depend on the community's pod VPA feature. Static pod manifest resource spec updates actually go through a delete-and-recreate process, but during the window kubelet can correctly account for the static pod's resource usage, ensuring that the SandboxPool's resources are not consumed by mis-scheduled pods during that period (this is what we care about most). I've added the relevant explanation in the "Update Flow" section.

Copilot AI review requested due to automatic review settings July 10, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
Comment thread docs/proposals/sandbox-pool-management/README.md
Copilot AI review requested due to automatic review settings July 10, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 7 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
memory: 16Mi
```

kubelet routes CRI calls to placeholder-agent's Socket (`/run/sandbox-pool/cri.sock`) based on the RuntimeClass handler name. The overhead values remain unchanged during VPA resize.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one question about the node-side RuntimeClass / CRI integration contract.

The updated proposal makes custom CRI interception part of the resource-adjustment path. It also says that kubelet routes CRI calls to /run/sandbox-pool/cri.sock based on the placeholder RuntimeClass handler, with placeholder-agent implementing the CRI server.

In kubelet v1.36.2, RuntimeClass is resolved to a runtimeHandler and passed to the already configured runtimeService.RunPodSandbox(...); it does not select a second CRI endpoint. With containerd, the handler selects a configured runtime/shim (or sandboxer integration) behind the same CRI service.

Could the proposal specify the missing integration layer between the placeholder handler and placeholder-agent?

  • Is placeholder-agent intended to integrate as a containerd runtime v2 shim / sandboxer?
  • Is there a CRI proxy in front of containerd that dispatches by runtime_handler?
  • Or is the node-wide kubelet CRI endpoint expected to point directly to placeholder-agent, with normal workloads forwarded elsewhere?

This determines which API placeholder-agent must implement, how normal Pods continue to use the default runtime, and whether the proposed per-Pod routing can work without replacing the node's CRI path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. The expectation here is to serve as the runtime implementation behind containerd, registered as a plugin into containerd. Therefore placeholder-agent implements the v2 shim interface.
I have already corrected the relevant content in the documentation.

Copilot AI review requested due to automatic review settings July 10, 2026 11:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 8 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Copilot AI review requested due to automatic review settings July 11, 2026 03:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md Outdated
Comment thread docs/proposals/sandbox-pool-management/README.md
Copilot AI review requested due to automatic review settings July 11, 2026 04:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread docs/proposals/sandbox-pool-management/README.md
Comment thread docs/proposals/sandbox-pool-management/README.md
Comment thread docs/proposals/sandbox-pool-management/README.md
Signed-off-by: lichuqiang <lichuqiang@huawei.com>
Copilot AI review requested due to automatic review settings July 12, 2026 04:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


- Provide declarative CRD APIs (SandboxPoolClass + SandboxPool) to manage node-level sandbox resource pools.
- Reliably lock scheduling resources through the Static Pod model; mirror pods are automatically rebuilt after accidental deletion (typically within seconds, depending on kubelet sync interval).
- Support adjusting placeholder Pod resource quotas via containerd runtime shim. This is NOT Kubernetes in-place Pod resize (InPlacePodVerticalScaling) — the placeholder Pod is rebuilt through Static Pod manifest update (delete/recreate), but running sandboxes managed by node-ctl are not interrupted during the rebuild.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants