@@ -78,15 +78,53 @@ const HOST_OPENSHELL_INTERNAL: &str = "host.openshell.internal";
7878const HOST_DOCKER_INTERNAL : & str = "host.docker.internal" ;
7979const DOCKER_NETWORK_DRIVER : & str = "bridge" ;
8080
81- /// Queried by the Docker driver to decide when a sandbox's supervisor
82- /// relay is live. Implementations return `true` once a sandbox has an
83- /// active `ConnectSupervisor` session registered.
81+ /// Default image holding the Linux `openshell-sandbox` binary. The gateway
82+ /// pulls this image and extracts the binary to a host-side cache when no
83+ /// explicit `supervisor_bin`, configured `supervisor_image`, sibling binary,
84+ /// or local build is available.
85+ const DEFAULT_DOCKER_SUPERVISOR_IMAGE_REPO : & str = "ghcr.io/nvidia/openshell/supervisor" ;
86+
87+ /// Return the default `ghcr.io/nvidia/openshell/supervisor:<tag>` reference
88+ /// used when no supervisor binary override is provided.
89+ pub fn default_docker_supervisor_image ( ) -> String {
90+ format ! (
91+ "{DEFAULT_DOCKER_SUPERVISOR_IMAGE_REPO}:{}" ,
92+ default_docker_supervisor_image_tag( )
93+ )
94+ }
95+
96+ /// Image tag baked in at compile time to pair the gateway with a matching
97+ /// supervisor image.
8498///
85- /// The driver cannot observe the supervisor's SSH socket directly (it
86- /// lives inside the container), so it leans on this signal to flip the
87- /// Ready condition from `DependenciesNotReady` to `True`.
88- pub trait SupervisorReadiness : Send + Sync + ' static {
89- fn is_supervisor_connected ( & self , sandbox_id : & str ) -> bool ;
99+ /// Build pipelines pass `OPENSHELL_IMAGE_TAG` explicitly. The `IMAGE_TAG`
100+ /// fallback covers image build wrappers that already tag the gateway and
101+ /// supervisor together. Standalone release binaries also patch the Cargo
102+ /// package version, so use it when it has been set to a real release value.
103+ fn default_docker_supervisor_image_tag ( ) -> String {
104+ resolve_default_docker_supervisor_image_tag (
105+ option_env ! ( "OPENSHELL_IMAGE_TAG" ) ,
106+ option_env ! ( "IMAGE_TAG" ) ,
107+ env ! ( "CARGO_PKG_VERSION" ) ,
108+ )
109+ }
110+
111+ fn resolve_default_docker_supervisor_image_tag (
112+ openshell_image_tag : Option < & ' static str > ,
113+ image_tag : Option < & ' static str > ,
114+ cargo_pkg_version : & ' static str ,
115+ ) -> String {
116+ let tag = openshell_image_tag
117+ . filter ( |tag| !tag. is_empty ( ) )
118+ . or_else ( || image_tag. filter ( |tag| !tag. is_empty ( ) ) )
119+ . unwrap_or_else ( || {
120+ if cargo_pkg_version. is_empty ( ) || cargo_pkg_version == "0.0.0" {
121+ "dev"
122+ } else {
123+ cargo_pkg_version
124+ }
125+ } ) ;
126+
127+ tag. replace ( '+' , "-" )
90128}
91129
92130/// Gateway-local configuration for the Docker compute driver.
@@ -211,7 +249,6 @@ pub struct DockerComputeDriver {
211249 config : DockerDriverRuntimeConfig ,
212250 events : broadcast:: Sender < WatchSandboxesEvent > ,
213251 pending : Arc < Mutex < HashMap < String , PendingSandboxRecord > > > ,
214- supervisor_readiness : Arc < dyn SupervisorReadiness > ,
215252 gpu_selector : Arc < CdiGpuDefaultSelector > ,
216253}
217254
@@ -308,11 +345,7 @@ type WatchStream =
308345 Pin < Box < dyn Stream < Item = Result < WatchSandboxesEvent , Status > > + Send + ' static > > ;
309346
310347impl DockerComputeDriver {
311- pub async fn new (
312- config : & Config ,
313- docker_config : & DockerComputeConfig ,
314- supervisor_readiness : Arc < dyn SupervisorReadiness > ,
315- ) -> CoreResult < Self > {
348+ pub async fn new ( config : & Config , docker_config : & DockerComputeConfig ) -> CoreResult < Self > {
316349 let socket_path = docker_config
317350 . socket_path
318351 . clone ( )
@@ -394,7 +427,6 @@ impl DockerComputeDriver {
394427 } ,
395428 events : broadcast:: channel ( WATCH_BUFFER ) . 0 ,
396429 pending : Arc :: new ( Mutex :: new ( HashMap :: new ( ) ) ) ,
397- supervisor_readiness,
398430 gpu_selector : Arc :: new ( CdiGpuDefaultSelector :: new (
399431 cdi_gpu_inventory,
400432 allow_all_default_gpu,
@@ -605,9 +637,9 @@ impl DockerComputeDriver {
605637 let container = self
606638 . find_managed_container_summary ( sandbox_id, sandbox_name)
607639 . await ?;
608- if let Some ( sandbox) = container . and_then ( |summary| {
609- sandbox_from_container_summary ( & summary, self . supervisor_readiness . as_ref ( ) )
610- } ) {
640+ if let Some ( sandbox) =
641+ container . and_then ( | summary| sandbox_from_container_summary ( & summary ) )
642+ {
611643 return Ok ( Some ( sandbox) ) ;
612644 }
613645
@@ -618,9 +650,7 @@ impl DockerComputeDriver {
618650 let containers = self . list_managed_container_summaries ( ) . await ?;
619651 let container_sandboxes = containers
620652 . iter ( )
621- . filter_map ( |summary| {
622- sandbox_from_container_summary ( summary, self . supervisor_readiness . as_ref ( ) )
623- } )
653+ . filter_map ( sandbox_from_container_summary)
624654 . collect :: < Vec < _ > > ( ) ;
625655 let mut by_id = self . pending_snapshot_map ( ) . await ;
626656 for sandbox in container_sandboxes {
@@ -1122,8 +1152,7 @@ impl DockerComputeDriver {
11221152 if let Some ( summary) = self
11231153 . find_managed_container_summary ( sandbox_id, sandbox_name)
11241154 . await ?
1125- && let Some ( sandbox) =
1126- sandbox_from_container_summary ( & summary, self . supervisor_readiness . as_ref ( ) )
1155+ && let Some ( sandbox) = sandbox_from_container_summary ( & summary)
11271156 {
11281157 self . publish_sandbox_snapshot ( sandbox) ;
11291158 }
@@ -2732,10 +2761,7 @@ fn parse_memory_limit(value: &str) -> Result<Option<i64>, Status> {
27322761 Ok ( Some ( ( amount * multiplier) . round ( ) as i64 ) )
27332762}
27342763
2735- fn sandbox_from_container_summary (
2736- summary : & ContainerSummary ,
2737- readiness : & dyn SupervisorReadiness ,
2738- ) -> Option < DriverSandbox > {
2764+ fn sandbox_from_container_summary ( summary : & ContainerSummary ) -> Option < DriverSandbox > {
27392765 let labels = summary. labels . as_ref ( ) ?;
27402766 let id = labels. get ( LABEL_SANDBOX_ID ) ?. clone ( ) ;
27412767 let name = labels. get ( LABEL_SANDBOX_NAME ) ?. clone ( ) ;
@@ -2744,27 +2770,21 @@ fn sandbox_from_container_summary(
27442770 . cloned ( )
27452771 . unwrap_or_default ( ) ;
27462772
2747- let supervisor_connected = readiness. is_supervisor_connected ( & id) ;
27482773 Some ( DriverSandbox {
27492774 id,
27502775 name : name. clone ( ) ,
27512776 namespace,
27522777 spec : None ,
2753- status : Some ( driver_status_from_summary (
2754- summary,
2755- & name,
2756- supervisor_connected,
2757- ) ) ,
2778+ status : Some ( driver_status_from_summary ( summary, & name) ) ,
27582779 } )
27592780}
27602781
27612782fn driver_status_from_summary (
27622783 summary : & ContainerSummary ,
27632784 sandbox_name : & str ,
2764- supervisor_connected : bool ,
27652785) -> DriverSandboxStatus {
27662786 let state = summary. state . unwrap_or ( ContainerSummaryStateEnum :: EMPTY ) ;
2767- let ( ready, reason, message, deleting) = container_ready_condition ( state, supervisor_connected ) ;
2787+ let ( ready, reason, message, deleting) = container_ready_condition ( state) ;
27682788
27692789 DriverSandboxStatus {
27702790 sandbox_name : summary_container_name ( summary) . unwrap_or_else ( || sandbox_name. to_string ( ) ) ,
@@ -2784,25 +2804,10 @@ fn driver_status_from_summary(
27842804
27852805fn container_ready_condition (
27862806 state : ContainerSummaryStateEnum ,
2787- supervisor_connected : bool ,
27882807) -> ( & ' static str , & ' static str , & ' static str , bool ) {
27892808 match state {
27902809 ContainerSummaryStateEnum :: RUNNING => {
2791- if supervisor_connected {
2792- (
2793- "True" ,
2794- "SupervisorConnected" ,
2795- "Supervisor relay is live" ,
2796- false ,
2797- )
2798- } else {
2799- (
2800- "False" ,
2801- "DependenciesNotReady" ,
2802- "Container is running; waiting for supervisor relay" ,
2803- false ,
2804- )
2805- }
2810+ ( "True" , "BackendReady" , "Container is running" , false )
28062811 }
28072812 ContainerSummaryStateEnum :: CREATED => ( "False" , "Starting" , "Container created" , false ) ,
28082813 ContainerSummaryStateEnum :: RESTARTING => (
0 commit comments