Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,6 @@ jobs:
--copy conformance-input/openshell-conformance:/tmp/openshell-conformance \
--copy nix/test-guest/conformance-plans/gateway-upgrade-restart.toml:/tmp/conformance-plan.toml \
--provision openshell-rpm-latest-release \
--provision gateway-rootless-podman \
--provision gateway-podman \
--provision openshell-rpm-gateway-upgrade \
-- /tmp/openshell-conformance run --plan /tmp/conformance-plan.toml
55 changes: 23 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ socket2 = "0.6"
# Serialization
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yml = "0.0.12"
serde_yml = { package = "noyalib", version = "0.0.28", default-features = false, features = ["std", "compat-serde-yaml"] }
toml = "0.8"
apollo-parser = "0.8.5"
tower-mcp-types = "0.12.0"
Expand Down
53 changes: 37 additions & 16 deletions crates/openshell-driver-docker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ use openshell_core::progress::{
format_bytes, mark_progress_active, mark_progress_complete, mark_progress_detail,
};
use openshell_core::proto::compute::v1::{
CreateSandboxRequest, CreateSandboxResponse, DeleteSandboxRequest, DeleteSandboxResponse,
DeleteWorkspaceRequest, DeleteWorkspaceResponse, DriverCondition, DriverPlatformEvent,
DriverSandbox, DriverSandboxStatus, DriverSandboxTemplate, EnsureWorkspaceRequest,
EnsureWorkspaceResponse, GatewayListenerRequirement, GetCapabilitiesRequest,
GetCapabilitiesResponse, GetGatewayListenerRequirementsRequest,
CpuResourceCapabilities, CreateSandboxRequest, CreateSandboxResponse, DeleteSandboxRequest,
DeleteSandboxResponse, DeleteWorkspaceRequest, DeleteWorkspaceResponse, DriverCondition,
DriverPlatformEvent, DriverSandbox, DriverSandboxStatus, DriverSandboxTemplate,
EnsureWorkspaceRequest, EnsureWorkspaceResponse, GatewayListenerRequirement,
GetCapabilitiesRequest, GetCapabilitiesResponse, GetGatewayListenerRequirementsRequest,
GetGatewayListenerRequirementsResponse, GetSandboxRequest, GetSandboxResponse,
GpuResourceRequirements, ListSandboxesRequest, ListSandboxesResponse, StartSandboxRequest,
StartSandboxResponse, StopSandboxRequest, StopSandboxResponse, ValidateSandboxCreateRequest,
GpuResourceCapabilities, GpuResourceRequirements, ListSandboxesRequest, ListSandboxesResponse,
MemoryResourceCapabilities, ResourceCapabilities, StartSandboxRequest, StartSandboxResponse,
StopSandboxRequest, StopSandboxResponse, ValidateSandboxCreateRequest,
ValidateSandboxCreateResponse, WatchSandboxesDeletedEvent, WatchSandboxesEvent,
WatchSandboxesPlatformEvent, WatchSandboxesRequest, WatchSandboxesSandboxEvent,
compute_driver_server::ComputeDriver, gateway_listener_requirement::Selector,
Expand Down Expand Up @@ -208,12 +209,17 @@ struct DockerDriverRuntimeConfig {
supervisor_bin: PathBuf,
guest_tls: Option<DockerGuestTlsPaths>,
daemon_version: String,
supports_gpu: bool,
allow_all_default_gpu: bool,
gpu: DockerGpuRuntimeCapabilities,
sandbox_pids_limit: i64,
enable_bind_mounts: bool,
}

#[derive(Debug, Clone, Copy)]
struct DockerGpuRuntimeCapabilities {
cdi_supported: bool,
wsl_all_gpu_fallback_enabled: bool,
}

#[derive(Debug, Clone, PartialEq, Eq)]
enum DockerGatewayRoute {
Bridge {
Expand Down Expand Up @@ -497,12 +503,16 @@ impl DockerComputeDriver {
let info = docker.info().await.map_err(|err| {
Error::execution(format!("failed to query Docker daemon info: {err}"))
})?;
let supports_gpu = info
let cdi_supported = info
.cdi_spec_dirs
.as_ref()
.is_some_and(|dirs| !dirs.is_empty());
let cdi_gpu_inventory = docker_cdi_gpu_inventory(&info);
let allow_all_default_gpu = docker_info_reports_wsl2(&info);
let wsl_all_gpu_fallback_enabled = docker_info_reports_wsl2(&info);
let gpu = DockerGpuRuntimeCapabilities {
cdi_supported,
wsl_all_gpu_fallback_enabled,
};
validate_sandbox_pids_limit(docker_config.sandbox_pids_limit)?;
let gateway_port = gateway_bind_address.port();
if gateway_port == 0 {
Expand Down Expand Up @@ -552,16 +562,15 @@ impl DockerComputeDriver {
supervisor_bin,
guest_tls,
daemon_version: version.version.unwrap_or_else(|| "unknown".to_string()),
supports_gpu,
allow_all_default_gpu,
gpu,
sandbox_pids_limit: docker_config.sandbox_pids_limit,
enable_bind_mounts: docker_config.enable_bind_mounts,
},
events: broadcast::channel(WATCH_BUFFER).0,
pending: Arc::new(Mutex::new(HashMap::new())),
gpu_selector: Arc::new(CdiGpuDefaultSelector::new(
cdi_gpu_inventory,
allow_all_default_gpu,
gpu.wsl_all_gpu_fallback_enabled,
)),
lifecycle_event_fences: DockerLifecycleEventFences::default(),
};
Expand All @@ -582,6 +591,18 @@ impl DockerComputeDriver {
gateway_manages_lifecycle: true,
supports_sandbox_authentication: false,
driver_reports_runtime_readiness: false,
resource_capabilities: Some(ResourceCapabilities {
cpu: Some(CpuResourceCapabilities {
limit_supported: true,
}),
memory: Some(MemoryResourceCapabilities {
limit_supported: true,
}),
gpu: Some(GpuResourceCapabilities {
default_selection_supported: self.config.gpu.cdi_supported,
count_selection_supported: self.config.gpu.cdi_supported,
}),
}),
}
}

Expand Down Expand Up @@ -613,7 +634,7 @@ impl DockerComputeDriver {
DockerSandboxDriverConfig::from_template(template).map_err(Status::invalid_argument)?;
validate_docker_driver_mounts(&driver_config.mounts, config.enable_bind_mounts)?;
let gpu_requirements = driver_gpu_requirements(spec.resource_requirements.as_ref());
Self::validate_gpu_request(gpu_requirements, config.supports_gpu, &driver_config)?;
Self::validate_gpu_request(gpu_requirements, config.gpu.cdi_supported, &driver_config)?;
Ok(ValidatedDockerSandbox {
template,
driver_config,
Expand Down Expand Up @@ -721,7 +742,7 @@ impl DockerComputeDriver {
.map_err(|err| internal_status("query Docker daemon info", err))?;
self.gpu_selector.refresh(
docker_cdi_gpu_inventory(&info),
self.config.allow_all_default_gpu,
self.config.gpu.wsl_all_gpu_fallback_enabled,
);
Ok(())
}
Expand Down
Loading
Loading