@@ -168,14 +168,18 @@ async def async_main():
168168 Initializes the distributed runtime, configures routing, and starts
169169 the HTTP server or interactive mode based on command-line arguments.
170170 """
171- # The system status server port is a worker concern.
171+ # The system status server port is usually a worker concern.
172172 #
173173 # Serve tests set DYN_SYSTEM_PORT for the worker, but aggregated launch scripts
174- # start `dynamo.frontend` first. If the frontend inherits DYN_SYSTEM_PORT, it can
175- # bind that port before the worker, causing port conflicts and/or scraping the
176- # wrong metrics endpoint.
174+ # start `dynamo.frontend` first. If the normal frontend inherits DYN_SYSTEM_PORT,
175+ # it can bind that port before the worker, causing port conflicts and/or scraping
176+ # the wrong metrics endpoint. Bulwark gateway endpoint mode intentionally keeps
177+ # the system server so Kubernetes readiness can gate the stable worker entity.
178+ frontend_system_port = os .environ .get ("DYN_SYSTEM_PORT" )
177179 os .environ .pop ("DYN_SYSTEM_PORT" , None )
178180 config , vllm_flags , sglang_flags = parse_args ()
181+ if config .bulwark_gateway_endpoint and frontend_system_port :
182+ os .environ ["DYN_SYSTEM_PORT" ] = frontend_system_port
179183 dump_config (config .dump_config_to , config )
180184 if config .event_plane :
181185 os .environ ["DYN_EVENT_PLANE" ] = config .event_plane
@@ -192,8 +196,9 @@ async def async_main():
192196 f"Request migration { 'enabled' if config .migration_limit > 0 else 'disabled' } "
193197 f"(limit: { config .migration_limit } { max_seq_info } )"
194198 )
195- # Warn if DYN_SYSTEM_PORT is set (frontend doesn't use system metrics server)
196- if os .environ .get ("DYN_SYSTEM_PORT" ):
199+ # Warn if DYN_SYSTEM_PORT is set for a normal frontend. Gateway endpoint mode
200+ # uses it for Kubernetes readiness.
201+ if os .environ .get ("DYN_SYSTEM_PORT" ) and not config .bulwark_gateway_endpoint :
197202 logger .warning (
198203 "=" * 80 + "\n "
199204 "WARNING: DYN_SYSTEM_PORT is set but NOT used by the frontend!\n "
@@ -307,7 +312,15 @@ def signal_handler():
307312 engine = await make_engine (runtime , e )
308313
309314 try :
310- if config .interactive :
315+ if config .bulwark_gateway_endpoint :
316+ logger .info (
317+ "Starting Bulwark frontend gateway at %s; private workers selected by namespace=%s namespace_prefix=%s" ,
318+ config .bulwark_gateway_endpoint ,
319+ config .namespace ,
320+ config .namespace_prefix ,
321+ )
322+ await run_input (runtime , config .bulwark_gateway_endpoint , engine )
323+ elif config .interactive :
311324 await run_input (runtime , "text" , engine )
312325 elif config .kserve_grpc_server :
313326 await run_input (runtime , "grpc" , engine )
0 commit comments