Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions architecture/compute-runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Each runtime receives a sandbox spec from the gateway and is responsible for:
- Reporting lifecycle and platform events back to the gateway.
- Cleaning up runtime-owned resources.

The capability RPC reports driver identity, version, and the default sandbox
image used by the gateway. GPU availability stays driver-local and is validated
when a sandbox create request asks for GPU resources.

## Runtime Summary

| Runtime | Best fit | Sandbox boundary | Notes |
Expand Down
2 changes: 0 additions & 2 deletions crates/openshell-driver-docker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ impl DockerComputeDriver {
driver_name: "docker".to_string(),
driver_version: self.config.daemon_version.clone(),
default_image: self.config.default_image.clone(),
supports_gpu: self.config.supports_gpu,
gpu_count: 0,
}
}

Expand Down
4 changes: 1 addition & 3 deletions crates/openshell-driver-kubernetes/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,11 @@ impl KubernetesComputeDriver {
})
}

pub async fn capabilities(&self) -> Result<GetCapabilitiesResponse, String> {
pub fn capabilities(&self) -> Result<GetCapabilitiesResponse, String> {
Ok(GetCapabilitiesResponse {
driver_name: "kubernetes".to_string(),
driver_version: openshell_core::VERSION.to_string(),
default_image: self.config.default_image.clone(),
supports_gpu: self.has_gpu_capacity().await.unwrap_or(false),
gpu_count: 0,
})
}

Expand Down
1 change: 0 additions & 1 deletion crates/openshell-driver-kubernetes/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ impl ComputeDriver for ComputeDriverService {
) -> Result<Response<GetCapabilitiesResponse>, Status> {
self.driver
.capabilities()
.await
.map(Response::new)
.map_err(Status::internal)
}
Expand Down
3 changes: 0 additions & 3 deletions crates/openshell-driver-podman/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,10 @@ impl PodmanComputeDriver {

/// Report driver capabilities.
pub fn capabilities(&self) -> Result<GetCapabilitiesResponse, ComputeDriverError> {
let supports_gpu = Self::has_gpu_capacity();
Ok(GetCapabilitiesResponse {
driver_name: "podman".to_string(),
driver_version: openshell_core::VERSION.to_string(),
default_image: self.config.default_image.clone(),
supports_gpu,
gpu_count: 0,
})
}

Expand Down
35 changes: 13 additions & 22 deletions crates/openshell-driver-vm/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,10 @@ impl VmDriver {

#[must_use]
pub fn capabilities(&self) -> GetCapabilitiesResponse {
let gpu_count = self
.gpu_inventory
.as_ref()
.and_then(|inv| inv.lock().ok())
.map_or(0, |inv| inv.gpu_count());
GetCapabilitiesResponse {
driver_name: DRIVER_NAME.to_string(),
driver_version: openshell_core::VERSION.to_string(),
default_image: self.config.default_image.clone(),
supports_gpu: self.gpu_inventory.is_some(),
gpu_count,
}
}

Expand Down Expand Up @@ -1522,25 +1515,23 @@ fn parse_registry_reference(image_ref: &str) -> Result<Reference, Status> {
/// `DOCKER_HOST`). If Docker is unavailable, falls back to the Podman
/// socket, which exposes a Docker-compatible API.
async fn connect_local_container_engine() -> Option<Docker> {
if let Ok(docker) = Docker::connect_with_local_defaults() {
if docker.ping().await.is_ok() {
return Some(docker);
}
if let Ok(docker) = Docker::connect_with_local_defaults()
&& docker.ping().await.is_ok()
{
return Some(docker);
}

let podman_socket = podman_socket_path();
if podman_socket.exists() {
if let Ok(docker) =
if podman_socket.exists()
&& let Ok(docker) =
Docker::connect_with_unix(podman_socket.to_str()?, 120, bollard::API_DEFAULT_VERSION)
{
if docker.ping().await.is_ok() {
info!(
socket = %podman_socket.display(),
"vm driver: connected to Podman (Docker-compatible API)"
);
return Some(docker);
}
}
&& docker.ping().await.is_ok()
{
info!(
socket = %podman_socket.display(),
"vm driver: connected to Podman (Docker-compatible API)"
);
return Some(docker);
}

None
Expand Down
4 changes: 0 additions & 4 deletions crates/openshell-server/src/compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,6 @@ impl ComputeDriver for NoopTestDriver {
driver_name: "noop-test-driver".to_string(),
driver_version: "test".to_string(),
default_image: "openshell/sandbox:test".to_string(),
supports_gpu: false,
gpu_count: 0,
},
))
}
Expand Down Expand Up @@ -1690,8 +1688,6 @@ mod tests {
driver_name: "test-driver".to_string(),
driver_version: "test".to_string(),
default_image: "openshell/sandbox:test".to_string(),
supports_gpu: true,
gpu_count: 0,
}))
}

Expand Down
7 changes: 3 additions & 4 deletions proto/compute_driver.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ service ComputeDriver {
message GetCapabilitiesRequest {}

message GetCapabilitiesResponse {
reserved 4, 5;
reserved "supports_gpu", "gpu_count";
Comment on lines +48 to +49
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drew would a breaking API change (simply removing the fields) be better in this case. I think we can add additional information as part of the resource requirement changes.


// Human-readable driver name.
string driver_name = 1;
// Driver implementation version string.
string driver_version = 2;
// Default sandbox image recommended by the driver.
string default_image = 3;
// True when the driver can provision GPU-backed sandboxes.
bool supports_gpu = 4;
// Number of GPUs available for sandbox assignment.
uint32 gpu_count = 5;
}

// Driver-owned sandbox model used for create requests and platform observations.
Expand Down
Loading