feat: in-place resize of workspace resources on running sandboxes#2
Open
noeljackson wants to merge 3 commits intopr/workspace-resources-onlyfrom
Open
feat: in-place resize of workspace resources on running sandboxes#2noeljackson wants to merge 3 commits intopr/workspace-resources-onlyfrom
noeljackson wants to merge 3 commits intopr/workspace-resources-onlyfrom
Conversation
f361431 to
71677e5
Compare
When SandboxClaim.spec.workspaceResources is updated on a claim with an
existing running sandbox, the controller now patches the pod's container
resources in-place. On Kubernetes 1.27+ with InPlacePodVerticalScaling,
this triggers the kubelet to call UpdateContainerResources on the
container runtime, resizing the workload without restart.
Previously, resource changes on existing claims were silently ignored
('sandbox already exists, skipping update').
a948568 to
b6fb6a9
Compare
6ce4cd1 to
7dd1b10
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
SandboxClaim.spec.workspaceResourcesis updated on a claim with an existing running sandbox, the controller now patches the pod's container resources in-place instead of silently ignoring the change.On Kubernetes 1.27+ with
InPlacePodVerticalScaling, this triggers the kubelet to callUpdateContainerResourceson the container runtime, resizing the workload without restart.Previously, resource changes on existing claims logged "sandbox already exists, skipping update" and returned without action.
Changes
reconcileWorkspaceResources()to the SandboxClaim controller reconcile loop. When a sandbox already exists, this compares the claim'sworkspaceResourceswith the pod's current container resources and patches them if they differ.buildResizePatch()helper that builds the resource diff. Only CPU and memory are compared. DiskGB (ephemeral storage) is intentionally excluded because it cannot be resized in-place.How it works
workspaceResourcesUpdateContainerResourceson the runtimeTest plan
go test ./extensions/...)workspaceResources: {memoryMB: 256, cpuMillicores: 1000}memoryMB: 512, cpuMillicores: 2000