Repository navigation
feat(driver-kubernetes): add empty_dir workspace volume with bounded size - #4473
Open
kon-angelo wants to merge 1 commit into
Open
kon-angelo wants to merge 1 commit into
kon-angelo wants to merge 1 commit into
Conversation
…size Add a `workspace_volume` option to the Kubernetes compute driver so a gateway can back each sandbox's /sandbox with a size-capped emptyDir instead of a per-sandbox PVC. This lets sandboxes run on clusters that have no dynamic storage provisioning or no default StorageClass, and removes the PVC lifecycle (orphaned claims, reclaim policy) from the teardown path — kubelet reclaims the emptyDir with the Pod. - workspace_volume (persistent_volume_claim | empty_dir); default persistent_volume_claim, so existing behaviour is unchanged. - empty_dir omits volumeClaimTemplates on the Sandbox CR and mounts a pod-level emptyDir at /sandbox, sized from workspace_default_storage_size as the sizeLimit. The workspace-init container still seeds /sandbox from the image on every pod start (the volume is empty each start). - workspace_max_storage_size (default 10Gi) bounds per-sandbox size overrides so a single sandbox cannot claim an unbounded workspace and starve the node; startup validation rejects a default above the maximum. - Per-sandbox overrides via driver_config.kubernetes.workspace_volume and workspace_storage_size, honoured only on gateways that set allow_driver_config. A requested size above the gateway maximum is rejected; workspace_storage_class applies to PVCs only. - Standalone driver env: OPENSHELL_K8S_WORKSPACE_VOLUME and OPENSHELL_K8S_WORKSPACE_MAX_STORAGE_SIZE. Refs: NVIDIA#2787 Signed-off-by: Konstantinos Angelopoulos <konstantinos.angelopoulos@sap.com>
|
All contributors have signed the DCO ✍️ ✅ |
kon-angelo
marked this pull request as ready for review
October 15, 2026 09:36
5 of 6 tasks
Author
|
I have read the DCO document and I hereby sign the DCO. |
This branch has not been deployed
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
Add a
workspace_volumeoption to the Kubernetes compute driver so a gateway can back each sandbox's/sandboxwith a size-cappedemptyDirinstead of a per-sandbox PVC. This lets sandboxes run on clusters that have no dynamic storage provisioning or no default StorageClass, and takes the PVC lifecycle (orphaned claims, reclaim policy) off the teardown path — kubelet reclaims theemptyDirwith the Pod. Default is unchanged (persistent_volume_claim).Related Issue
Closes #2787
Changes
workspace_volumegateway setting (persistent_volume_claimdefault |empty_dir); default preserves current behaviour byte-for-byte.empty_diromitsvolumeClaimTemplateson the Sandbox CR and mounts a pod-levelemptyDirat/sandbox, withsizeLimitsourced fromworkspace_default_storage_size. Theworkspace-initcontainer still seeds/sandboxfrom the image on every pod start (the volume is empty each start).workspace_max_storage_size(default10Gi) bounds per-sandbox size overrides so one sandbox cannot claim an unbounded workspace and starve the node; startup validation rejects a default above the maximum.driver_config.kubernetes.workspace_volumeandworkspace_storage_size, honoured only on gateways that setallow_driver_config. A requested size above the gateway maximum is rejected;workspace_storage_classapplies to PVCs only.OPENSHELL_K8S_WORKSPACE_VOLUME,OPENSHELL_K8S_WORKSPACE_MAX_STORAGE_SIZE.Testing
cargo test -p openshell-driver-kubernetes: 304 pass;cargo clippyclean;openshell-serverbuilds)Also verified manually on a local k3d cluster deployed with
workspace_volume = empty_dir+allow_driver_config = true:Readywith no workspace PVC; CR has novolumeClaimTemplates; Pod volume isemptyDir={"sizeLimit":"2Gi"};workspace-initseeds/sandbox.workspace_storage_size: 5Gi→sizeLimit: 5Gi;50Gi(> 10Gi max) → rejected with a clear error./sandboxis gone after stop/start (ephemeral contract).Checklist