Skip to content

Commit e149bff

Browse files
committed
docs(rfc): finalize sandbox resource requirements
1 parent 1aafb69 commit e149bff

1 file changed

Lines changed: 45 additions & 71 deletions

File tree

  • rfc/0004-sandbox-resource-requirements

rfc/0004-sandbox-resource-requirements/README.md

Lines changed: 45 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
authors:
33
- "@elezar"
4-
state: draft
4+
state: accepted
55
links:
66
- https://github.com/NVIDIA/OpenShell/issues/1338
77
- https://github.com/NVIDIA/OpenShell/pull/1340
8+
- https://github.com/NVIDIA/OpenShell/pull/1360
9+
- https://github.com/NVIDIA/OpenShell/issues/1492
810
---
911

1012
# RFC 0004 - Sandbox Resource Requirements
@@ -54,6 +56,8 @@ configuration rather than portable resources.
5456
The proposal is inspired by Kubernetes Dynamic Resource Allocation structured
5557
parameters: scheduler-visible selection is structured, while driver-specific
5658
configuration remains separate and is interpreted by the resource driver.
59+
Exposing a general-purpose driver-specific configuration surface is related, but
60+
tracked separately in issue #1492.
5761

5862
## Non-goals
5963

@@ -62,6 +66,8 @@ configuration remains separate and is interpreted by the resource driver.
6266
- Building a gateway-level scheduler or reservation system.
6367
- Exposing detailed per-device inventory from drivers.
6468
- Exposing JSON-formatted portable resource requests in the CLI.
69+
- Defining the general driver-specific configuration passthrough API. Issue
70+
#1492 tracks that related API surface.
6571
- Publishing allocated resource identities in sandbox status.
6672
- Preserving long-term compatibility for `gpu`, `gpu_device`, or a
6773
GPU-specific `gpu_count` request field.
@@ -97,33 +103,10 @@ resource requests and limits, but it is not the portable resource contract.
97103
The CLI should not expose a JSON flag for `resource_requirements`. Common
98104
portable requests should use typed flags such as CPU, memory, and GPU-count
99105
flags, and SDK/API callers should use the typed protobuf messages directly.
100-
JSON-formatted CLI input is reserved for driver-specific configuration.
101-
102-
The long-term public API should expose one opaque driver configuration field on
103-
the template instead of adding more JSON-shaped resource inputs:
104-
105-
```proto
106-
message SandboxTemplate {
107-
string image = 1;
108-
string runtime_class_name = 2;
109-
string agent_socket = 3;
110-
map<string, string> labels = 4;
111-
map<string, string> annotations = 5;
112-
map<string, string> environment = 6;
113-
114-
// Driver/platform-native configuration. Top-level keys are DNS-style
115-
// namespaces such as kubernetes.openshell.ai, docker.openshell.ai, or
116-
// vm.openshell.ai. The gateway validates shape and size but does not
117-
// interpret the values for portable resource matching.
118-
map<string, google.protobuf.Struct> driver_config = 11;
119-
}
120-
```
121-
122-
Existing JSON passthrough such as PR #1340's `--resources-json` should be
123-
renamed to `--driver-config-json` before it becomes a stable CLI contract, or
124-
treated as transitional if it has already shipped. The flag writes the provided
125-
object into `SandboxTemplate.driver_config`; it does not populate
126-
`SandboxSpec.resource_requirements`.
106+
JSON-formatted driver-specific configuration is a related but separate API
107+
topic. Issue #1492 tracks exposing an opaque driver-owned configuration surface,
108+
potentially named `driver_config`. This RFC only requires that driver-native
109+
configuration remains separate from portable resource requirements.
127110

128111
### Resource requirements
129112

@@ -218,6 +201,14 @@ Compute requirements are fungible CPU and memory requirements. They differ from
218201
devices because they usually do not need exact identity or driver-specific
219202
selection.
220203

204+
This RFC standardizes only CPU and memory as initial portable compute
205+
requirements. Other compute-shaped constraints such as ephemeral storage, huge
206+
pages, PID limits, shared memory, or similar cgroup-backed limits may be added
207+
later, but only once their request/limit semantics are clear and they can map to
208+
multiple drivers. Driver-specific support for such constraints should stay in
209+
driver-specific configuration until it is portable enough for the first-party
210+
API.
211+
221212
Example request:
222213

223214
```yaml
@@ -238,6 +229,13 @@ Example realizations:
238229
| Podman | Apply supported runtime limits such as CPU quota and memory limit. Requests are capacity checks when the driver can evaluate host capacity. |
239230
| VM | Map CPU and memory limits to VM vCPU count and guest memory allocation. The driver may require request and limit to be equal when it cannot represent separate request/limit semantics. |
240231

232+
Compute requirements describe the sandbox workload that the driver provisions,
233+
not every runtime-managed helper process. If a driver later runs the proxy,
234+
supervisor, or other control-plane helpers in separate containers, sidecars, or
235+
pods, it may apply fixed overhead or expose helper-specific settings through
236+
driver-specific configuration. Those helper resources are driver implementation
237+
details unless a later RFC promotes them into portable resource requirements.
238+
241239
Drivers must reject compute requirements they cannot honor. They must not
242240
silently accept a limit or request that has no effect.
243241

@@ -504,38 +502,20 @@ validation failure: portable GPU count conflicts with template GPU limit
504502
The request must fail rather than letting either source silently override the
505503
other.
506504

507-
### Driver-specific JSON configuration
508-
509-
The only JSON-formatted CLI escape hatch proposed by this RFC is
510-
`--driver-config-json`. It is for driver/platform-specific configuration, not
511-
portable resource requests.
505+
### Related driver-specific configuration
512506

513-
Example:
514-
515-
```shell
516-
openshell sandbox create \
517-
--driver-config-json '{"kubernetes.openshell.ai":{"nodeSelector":{"accelerator":"nvidia"}}}'
518-
```
519-
520-
Request shape:
521-
522-
```yaml
523-
template:
524-
driverConfig:
525-
kubernetes.openshell.ai:
526-
nodeSelector:
527-
accelerator: nvidia
528-
```
529-
530-
The gateway may use the presence of a driver-config namespace as a compatibility
531-
prefilter, but it must not inspect driver-config values as portable resource
532-
requirements. CPU, memory, GPU count, and exact GPU selection should use typed
533-
resource fields or typed CLI flags.
507+
Driver-specific configuration is intentionally separate from portable resource
508+
requirements. Issue #1492 tracks an opaque driver-owned configuration surface
509+
for backend-native settings such as Kubernetes node selectors, tolerations,
510+
image pull secrets, Docker network mode, or VM disk shape. A future design may
511+
place that surface on `SandboxTemplate.driver_config` and may use a namespaced
512+
map-of-maps shape, but this RFC does not standardize that API or its CLI flags.
534513

535514
This RFC does not introduce `--resources-json`, `--resource-requirements-json`,
536-
or `--template-resources-json`. If a driver needs backend-native resource
537-
settings that are not modeled by `resource_requirements`, they belong under
538-
that driver's `--driver-config-json` namespace and remain driver-specific.
515+
or `--template-resources-json`. CPU, memory, GPU count, and exact GPU selection
516+
should use typed resource fields or typed CLI flags. Backend-native settings
517+
that are not modeled by `resource_requirements` should remain driver-specific
518+
and should not be presented as portable resource requests.
539519

540520
### Template realization and conflicts
541521

@@ -555,13 +535,10 @@ not silently override portable resource intent with template passthrough values,
555535
or template passthrough values with portable resource intent.
556536

557537
Requests with only `SandboxTemplate.resources` are valid platform-native
558-
passthrough, but they do not participate in portable driver matching.
559-
560-
In the breaking API proposed by this RFC, new driver-native JSON should use
561-
`SandboxTemplate.driver_config`. Existing `SandboxTemplate.resources` behavior
562-
can be preserved during migration, but should not gain a stable CLI flag named
563-
`--resources-json` because that name conflicts with portable resource
564-
requirements.
538+
passthrough, but they do not participate in portable driver matching. Existing
539+
`SandboxTemplate.resources` behavior can be preserved during migration, but
540+
should not gain a stable CLI flag named `--resources-json` because that name
541+
conflicts with portable resource requirements.
565542

566543
### Driver request model
567544

@@ -677,9 +654,7 @@ default behavior and use the configured default driver.
677654
namespaces.
678655
7. Update CLI/API request construction so CPU, memory, GPU count, and exact GPU
679656
selection use resource requirements instead of GPU-specific request fields.
680-
8. Rename JSON passthrough to `--driver-config-json` and map it to
681-
`SandboxTemplate.driver_config`; do not expose JSON-formatted portable
682-
resource request flags.
657+
8. Do not expose JSON-formatted portable resource request flags.
683658
9. Update user-facing docs and driver README files once behavior is
684659
implemented.
685660

@@ -709,8 +684,7 @@ The implementation should include:
709684
index with `vm.openshell.ai`.
710685
- tests showing that template-only resources are treated as platform-native
711686
passthrough and are not used for portable driver matching.
712-
- CLI request-shape tests showing that `--driver-config-json` populates
713-
`SandboxTemplate.driver_config` and that there is no JSON-formatted portable
687+
- CLI request-shape tests showing that there is no JSON-formatted portable
714688
resource request flag.
715689
- error-message tests for no matching driver and validation failure across all
716690
candidates.
@@ -742,8 +716,8 @@ The implementation should include:
742716
passthrough surface.
743717
- Expose `--resources-json` as a CLI shortcut for `SandboxTemplate.resources`.
744718
This matches PR #1340's immediate implementation direction, but the name
745-
implies portable resource semantics. `--driver-config-json` is more explicit
746-
about the backend-native nature of the data.
719+
implies portable resource semantics. Backend-native configuration needs a
720+
separate driver-specific design, tracked by issue #1492.
747721
- Use a repeated `kind`-based requirement for all resources. This keeps gateway
748722
matching generic, but makes common resources such as CPU, memory, and GPU more
749723
stringly typed than necessary.

0 commit comments

Comments
 (0)