Skip to content

feat: support memory resize for sandbox claims#519

Open
PersistentJZH wants to merge 2 commits into
openkruise:masterfrom
PersistentJZH:feature/memory-resource-resize
Open

feat: support memory resize for sandbox claims#519
PersistentJZH wants to merge 2 commits into
openkruise:masterfrom
PersistentJZH:feature/memory-resource-resize

Conversation

@PersistentJZH

Copy link
Copy Markdown
Member

Ⅰ. Describe what this PR does

SandboxClaim resource resize previously only supported CPU. Kubernetes in-place pod resize supports both CPU and memory, with behavior controlled by the pod container resizePolicy.

Memory resize should be supported through both the CRD API and the E2B-compatible API path, while preserving the resize policy already defined on the underlying SandboxSet/Sandbox pod template.

  • Allow SandboxClaim inplaceUpdate.resources and E2B extensions to resize memory in addition to CPU.

  • Patch the pods/resize subresource instead of sending a full subresource update so existing container resizePolicy entries are preserved by the API server.

  • Add unit and e2e coverage for CPU and memory resize behavior, including RestartContainer and NotRequired resizePolicy cases.

Ⅱ. Does this pull request fix one issue?

#515

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

- Allow SandboxClaim inplaceUpdate.resources and E2B extensions to resize
memory in addition to CPU.

- Patch the pods/resize subresource instead of sending a full subresource
update so existing container resizePolicy entries are preserved by the API
server.

- Add unit and e2e coverage for CPU and memory resize behavior, including
RestartContainer and NotRequired resizePolicy cases.
@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 furykerry for approval by writing /assign @furykerry 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 Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.04478% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.42%. Comparing base (d0b289a) to head (bdea7a7).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
pkg/utils/inplaceupdate/inplace_update.go 89.47% 2 Missing and 2 partials ⚠️
pkg/sandbox-manager/infra/sandboxcr/claim.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #519      +/-   ##
==========================================
+ Coverage   79.23%   79.42%   +0.18%     
==========================================
  Files         184      189       +5     
  Lines       12971    13432     +461     
==========================================
+ Hits        10278    10668     +390     
- Misses       2317     2373      +56     
- Partials      376      391      +15     
Flag Coverage Δ
unittests 79.42% <91.04%> (+0.18%) ⬆️

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.

Signed-off-by: PersistentJZH <zhihao.kan17@gmail.com>

Generate the Pod resize strategic merge patch directly instead of building
a Pod-shaped resize body and converting it later. This keeps the resize
payload scoped to changed regular containers and avoids carrying unrelated
fields such as initContainers, metadata, or resizePolicy through the
resize path.

Also add regression coverage for Pods with init containers to ensure
main-container resize does not mutate init container resources.
@PersistentJZH PersistentJZH changed the title [WIP] feat: support memory resize for sandbox claims feat: support memory resize for sandbox claims Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants