Skip to content

Commit 45614a3

Browse files
authored
refactor(api): remove SandboxTemplate.volume_claim_templates (ai-openshell#2088)
The field was added during the Kubernetes driver extraction refactor (ai-openshell#817) as a pass-through mechanism, but was never wired up to a CLI flag, Python SDK helper, or any documentation. The only reachable user path was raw gRPC construction. The Kubernetes driver now always injects the default workspace PVC, removing the branching logic that checked for a user-supplied VCT. Field number 9 is reserved in the proto to prevent reuse. Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 450685c commit 45614a3

4 files changed

Lines changed: 10 additions & 48 deletions

File tree

‎crates/openshell-driver-kubernetes/src/driver.rs‎

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,17 +1298,6 @@ fn sandbox_to_k8s_spec(
12981298
) -> serde_json::Value {
12991299
let mut root = serde_json::Map::new();
13001300

1301-
// Determine early whether the user provided custom volumeClaimTemplates.
1302-
// When they haven't, we inject a default workspace VCT and corresponding
1303-
// init container + volume mount so sandbox data persists. We need this
1304-
// flag before building the podTemplate because the workspace persistence
1305-
// transforms are applied inside sandbox_template_to_k8s.
1306-
let user_has_vct = spec
1307-
.and_then(|s| s.template.as_ref())
1308-
.and_then(|t| platform_config_struct(t, "volume_claim_templates"))
1309-
.is_some();
1310-
let inject_workspace = !user_has_vct;
1311-
13121301
if let Some(spec) = spec {
13131302
let pod_env = spec_pod_env(Some(spec));
13141303
if let Some(template) = spec.template.as_ref() {
@@ -1318,7 +1307,7 @@ fn sandbox_to_k8s_spec(
13181307
template,
13191308
driver_gpu_requirements(spec.resource_requirements.as_ref()),
13201309
&pod_env,
1321-
inject_workspace,
1310+
true,
13221311
params,
13231312
),
13241313
);
@@ -1328,22 +1317,13 @@ fn sandbox_to_k8s_spec(
13281317
serde_json::json!(template.agent_socket_path),
13291318
);
13301319
}
1331-
if let Some(volume_templates) =
1332-
platform_config_struct(template, "volume_claim_templates")
1333-
{
1334-
root.insert("volumeClaimTemplates".to_string(), volume_templates);
1335-
}
13361320
}
13371321
}
13381322

1339-
// Inject the default workspace volumeClaimTemplate when the user didn't
1340-
// provide their own.
1341-
if inject_workspace {
1342-
root.insert(
1343-
"volumeClaimTemplates".to_string(),
1344-
default_workspace_volume_claim_templates(params.workspace_default_storage_size),
1345-
);
1346-
}
1323+
root.insert(
1324+
"volumeClaimTemplates".to_string(),
1325+
default_workspace_volume_claim_templates(params.workspace_default_storage_size),
1326+
);
13471327

13481328
// podTemplate is required by the Kubernetes CRD - ensure it's always present
13491329
if !root.contains_key("podTemplate") {
@@ -1354,7 +1334,7 @@ fn sandbox_to_k8s_spec(
13541334
&SandboxTemplate::default(),
13551335
driver_gpu_requirements(spec.and_then(|s| s.resource_requirements.as_ref())),
13561336
&pod_env,
1357-
inject_workspace,
1337+
true,
13581338
params,
13591339
),
13601340
);

‎crates/openshell-server/src/compute/mod.rs‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,8 +1666,8 @@ fn extract_typed_resources(
16661666
}
16671667

16681668
/// Build the opaque `platform_config` Struct from platform-specific public
1669-
/// template fields (`runtime_class_name`, annotations, `volume_claim_templates`)
1670-
/// plus any resource fields beyond CPU/memory.
1669+
/// template fields (`runtime_class_name`, annotations) plus any resource fields
1670+
/// beyond CPU/memory.
16711671
fn build_platform_config(template: &SandboxTemplate) -> Option<prost_types::Struct> {
16721672
use prost_types::{Struct, Value, value::Kind};
16731673

@@ -1705,16 +1705,6 @@ fn build_platform_config(template: &SandboxTemplate) -> Option<prost_types::Stru
17051705
);
17061706
}
17071707

1708-
// Pass through the raw volume_claim_templates Struct as a nested value.
1709-
if let Some(ref vct) = template.volume_claim_templates {
1710-
fields.insert(
1711-
"volume_claim_templates".to_string(),
1712-
Value {
1713-
kind: Some(Kind::StructValue(vct.clone())),
1714-
},
1715-
);
1716-
}
1717-
17181708
// Invert: the public API uses `user_namespaces: true` (positive sense)
17191709
// while the K8s driver expects `host_users: false` (K8s convention).
17201710
// The driver inverts this back via `!host_users` to resolve the final

‎crates/openshell-server/src/grpc/validation.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,6 @@ fn validate_sandbox_template(tmpl: &SandboxTemplate) -> Result<(), Status> {
206206
)));
207207
}
208208
}
209-
if let Some(ref s) = tmpl.volume_claim_templates {
210-
let size = s.encoded_len();
211-
if size > MAX_TEMPLATE_STRUCT_SIZE {
212-
return Err(Status::invalid_argument(format!(
213-
"template.volume_claim_templates serialized size exceeds maximum ({size} > {MAX_TEMPLATE_STRUCT_SIZE})"
214-
)));
215-
}
216-
}
217209
if let Some(ref s) = tmpl.driver_config {
218210
let size = s.encoded_len();
219211
if size > MAX_TEMPLATE_STRUCT_SIZE {

‎proto/openshell.proto‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ message SandboxTemplate {
362362
map<string, string> environment = 6;
363363
// Platform-specific compute resource requirements and limits.
364364
google.protobuf.Struct resources = 7;
365-
// Optional platform-specific volume claim templates.
366-
google.protobuf.Struct volume_claim_templates = 9;
365+
reserved 9;
366+
reserved "volume_claim_templates";
367367
// Enable Kubernetes user namespace isolation (hostUsers: false).
368368
// When true, container UID 0 maps to a non-root host UID and capabilities
369369
// become namespaced. Requires Kubernetes 1.33+ with user namespace support

0 commit comments

Comments
 (0)