Skip to content

feat(sandbox-manager): add OpenSandbox-compatible control-plane APIs - #1059

Draft
zhuangzhewei09 wants to merge 1 commit into
openkruise:masterfrom
zhuangzhewei09:feat/opensandbox-compat-lifecycle
Draft

zhuangzhewei09 wants to merge 1 commit into
openkruise:masterfrom
zhuangzhewei09:feat/opensandbox-compat-lifecycle

Conversation

@zhuangzhewei09

@zhuangzhewei09 zhuangzhewei09 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR does

Consolidate all OpenSandbox control-plane implementation in sandbox-manager: creation, list, describe, delete, asynchronous pause/resume, expiration renewal, and endpoint discovery. The opt-in adapter shares the existing HTTP listener, API-key storage and SandboxManager with E2B.

  • Create from an image, named SandboxSet or Checkpoint through native allocation, initialization, admission, quota and cleanup. Keep wire models, authorization, validation and error mapping in the API layer.
  • Scope sandbox visibility by key owner and namespace. Preserve native E2B completion waits while OpenSandbox pause/resume returns 202 after intent persistence. Use version-checked partial patches, conflict rechecks, atomic timeout updates and native coordination.
  • Resolve owned-instance ingress/direct endpoints and execution credentials through SandboxManager.GetSandboxConnection. Select opensandbox-runtime for cold creation and use optional AdditionalInitPorts for native-token initialization. Pool/Checkpoint workloads and initialization configuration retain source inheritance.
  • Include the updated control-plane proposal and all nineteen SDK creation/lifecycle scenarios. The compatible command/file runtime and complete cluster workflow require a follow-up update to feat(opensandbox): add command and file data plane compatibility #1081.

Ⅱ. Does this pull request fix one issue?

Refs #690. This PR contains the complete current control-plane implementation and has no create-implementation dependency on #989. The published #989 still contains its earlier create implementation and proposal; reducing it to proposal-only remains pending. #1081 has not yet been rebuilt on this head.

Ⅲ. Describe how to verify it

Local checks passed on 16deb951018faf6923d7050da4de9b16d1d85003, base 641b7d7efc2bc8ba11207ece0b0236caca8de79f, with Go 1.26.5:

go test ./pkg/servers/opensandbox ./pkg/utils/runtime ./cmd/sandbox-manager -count=1

Go 1.25.9 verification also passed: the runtime package passed, and the API/entrypoint packages passed with -p 1 after an initial disk-space failure during parallel linking. The source tree and commit remain unchanged.

Coverage includes endpoint ownership and ingress/direct routing, lifecycle routes, creation mapping and additional initialization while retaining the native default path. Proposal links and whitespace checks passed. All nineteen SDK scenarios remain present; cluster E2E was not rerun during this consolidation.

Ⅳ. Special notes for reviews

The implementation is one signed commit. The retained base is six commits behind fetched master ef1a626, including lifecycle hooks in #1116, tracing changes in #1127 and the dedicated metrics-listener health route in #1132. Shared call signatures were checked; validation above is bound to the retained base and must be repeated after base integration.

Deployments using compatibility creation must provide the compatibility runtime image and injection configuration. Pool workloads must already include the compatibility service. Additional initialization uses HTTP and explicitly rejects TLS-only bridging. The complete SDK cluster environment is planned for a follow-up update to #1081; this PR retains the nineteen control-plane scenarios and independently runnable Go tests.

202 means accepted intent; describe may lag, and callers wait for Ready after resume. Real checkpoint/filesystem/CSI restoration, process-restart recovery and runtime initialization failure recovery retain separate deployment-backed verification. Description responses keep an empty entrypoint and omit startup-source fields.

Networking retains native allow-before-deny semantics, default access and publication order without a first-traffic barrier. Pool image/resources use native best-effort updates, snapshot configuration is inherited, PVCs must exist, and unsupported source/security/resource overrides retain the proposal's errors. Cold creation retains the native outer retry boundary. Signed endpoints and general Lifecycle Server Proxy requests return 501.

@kruise-bot

Copy link
Copy Markdown

[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 zmberg for approval by writing /assign @zmberg in a comment. 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

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.25684% with 221 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.49%. Comparing base (641b7d7) to head (16deb95).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
pkg/servers/opensandbox/create.go 89.22% 18 Missing and 14 partials ⚠️
pkg/servers/opensandbox/endpoint.go 52.30% 20 Missing and 11 partials ⚠️
...g/sandbox-manager/infra/sandboxcr/volume_mounts.go 67.04% 17 Missing and 12 partials ⚠️
pkg/servers/opensandbox/list.go 81.19% 16 Missing and 6 partials ⚠️
pkg/servers/validation/securityrules.go 86.16% 12 Missing and 10 partials ⚠️
pkg/sandbox-manager/infra/sandboxcr/cold_start.go 89.65% 5 Missing and 4 partials ⚠️
pkg/servers/opensandbox/delete.go 62.50% 6 Missing and 3 partials ⚠️
pkg/sandbox-manager/connection.go 0.00% 8 Missing ⚠️
pkg/servers/opensandbox/project.go 84.90% 7 Missing and 1 partial ⚠️
pkg/sandbox-manager/infra/sandboxcr/claim.go 62.50% 3 Missing and 3 partials ⚠️
... and 15 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1059      +/-   ##
==========================================
+ Coverage   84.38%   84.49%   +0.10%     
==========================================
  Files         273      296      +23     
  Lines       24550    26142    +1592     
==========================================
+ Hits        20717    22089    +1372     
- Misses       3041     3186     +145     
- Partials      792      867      +75     
Flag Coverage Δ
unittests 84.49% <85.25%> (+0.10%) ⬆️

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.

@zhuangzhewei09
zhuangzhewei09 force-pushed the feat/opensandbox-compat-lifecycle branch from 69df6fa to 19da857 Compare October 18, 2026 05:49
@zhuangzhewei09
zhuangzhewei09 force-pushed the feat/opensandbox-compat-lifecycle branch from 19da857 to f4f275e Compare October 25, 2026 18:59
@zhuangzhewei09
zhuangzhewei09 force-pushed the feat/opensandbox-compat-lifecycle branch from f4f275e to 04b5b4e Compare October 26, 2026 11:19
Expose creation, list, describe, delete, asynchronous pause/resume,
expiration renewal and owned-instance endpoint discovery through the
existing sandbox-manager listener, API-key storage and Manager.
Support image cold creation, named SandboxSet claims and Checkpoint
clones while retaining native E2B defaults and ownership policy.

Persist lifecycle intent with version-checked partial patches and native
coordination. Resolve ingress/direct endpoint addresses and credentials
through a neutral Manager connection observation. Select compatibility
runtime injection and initialize optional additional runtime ports with
the native credential while preserving the default E2B init path.

Define the complete control-plane proposal and keep command/file service
implementations separate. Retain the nineteen official-SDK creation and
lifecycle scenarios; deliver their cluster workflow with the compatible
runtime image and injection environment.

Validation on base 641b7d7:
go test ./pkg/servers/opensandbox ./pkg/utils/runtime ./cmd/sandbox-manager
-count=1 passed with Go 1.26.5. Proposal internal links and reference
symbols resolve, and git diff --check passes. Cluster SDK cases were not
rerun as part of this branch consolidation.

Refs openkruise#690

Signed-off-by: zhuangzhewei09 <zhuangzhewei09@dingtalk.com>
@zhuangzhewei09
zhuangzhewei09 force-pushed the feat/opensandbox-compat-lifecycle branch from 04b5b4e to 16deb95 Compare October 27, 2026 15:44
@zhuangzhewei09 zhuangzhewei09 changed the title feat(sandbox-manager): add OpenSandbox-compatible lifecycle APIs feat(sandbox-manager): add OpenSandbox-compatible control-plane APIs Oct 27, 2026
zhuangzhewei09 added a commit to zhuangzhewei09/agents that referenced this pull request Oct 27, 2026
Define creation, identity, network access, lifecycle and endpoint-discovery
contracts using native E2B orchestration. Include ingress/direct credential
projection, runtime selection and additional-port initialization, source
inheritance, observable differences and acceptance criteria.

Limit this change to the proposal; all control-plane implementation and
tests are maintained in PR openkruise#1059. Command/file service implementations and
their runtime image remain a separate data-plane delivery.

Validation: proposal content matches the control-plane implementation
branch; internal anchors and official reference definitions resolve;
git diff --check passes against base
0646203.

Refs openkruise#690

Signed-off-by: zhuangzhewei09 <zhuangzhewei09@dingtalk.com>
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.

2 participants