@@ -168,6 +168,8 @@ pub struct ControlPlaneStarter<'a, N: NexusServer> {
168168 pub simulated_upstairs : Arc < sim:: SimulatedUpstairs > ,
169169
170170 db_listen_port : u16 ,
171+ internal_dns_listen_port : u16 ,
172+ mgs_listen_port : Option < u16 > ,
171173}
172174
173175type StepInitFn < ' a , N > = Box <
@@ -219,11 +221,25 @@ impl<'a, N: NexusServer> ControlPlaneStarter<'a, N> {
219221 simulated_upstairs_log,
220222 ) ) ,
221223 db_listen_port : dev:: db:: COCKROACHDB_DEFAULT_LISTEN_PORT ,
224+ internal_dns_listen_port : 0 ,
225+ mgs_listen_port : None ,
222226 }
223227 }
224228
225- pub fn db_listen_port ( & mut self , port : u16 ) {
226- self . db_listen_port = port;
229+ pub fn db_listen_port ( & mut self , port : Option < u16 > ) {
230+ if let Some ( port) = port {
231+ self . db_listen_port = port;
232+ }
233+ }
234+
235+ pub fn internal_dns_listen_port ( & mut self , port : Option < u16 > ) {
236+ if let Some ( port) = port {
237+ self . internal_dns_listen_port = port;
238+ }
239+ }
240+
241+ pub fn mgs_listen_port ( & mut self , port : Option < u16 > ) {
242+ self . mgs_listen_port = port;
227243 }
228244
229245 pub async fn init_with_steps (
@@ -1212,7 +1228,18 @@ impl<'a, N: NexusServer> ControlPlaneStarter<'a, N> {
12121228 /// Set up an internal DNS server on the first sled agent
12131229 pub async fn start_internal_dns ( & mut self ) {
12141230 let log = self . logctx . log . new ( o ! ( "component" => "internal_dns_server" ) ) ;
1215- let dns = dns_server:: TransientServer :: new ( & log) . await . unwrap ( ) ;
1231+ let dns_addr = SocketAddrV6 :: new (
1232+ Ipv6Addr :: LOCALHOST ,
1233+ self . internal_dns_listen_port ,
1234+ 0 ,
1235+ 0 ,
1236+ ) ;
1237+ let dns = dns_server:: TransientServer :: new_with_address (
1238+ & log,
1239+ dns_addr. into ( ) ,
1240+ )
1241+ . await
1242+ . unwrap ( ) ;
12161243
12171244 let SocketAddr :: V6 ( dns_address) = dns. dns_server . local_address ( ) else {
12181245 panic ! ( "Unsupported IPv4 DNS address" ) ;
@@ -1633,7 +1660,7 @@ pub(crate) async fn setup_with_config_impl<N: NexusServer>(
16331660 builder
16341661 . start_gateway(
16351662 SwitchLocation :: Switch0 ,
1636- None ,
1663+ builder . mgs_listen_port ,
16371664 mgs_config,
16381665 )
16391666 . boxed( )
@@ -1677,7 +1704,7 @@ pub(crate) async fn setup_with_config_impl<N: NexusServer>(
16771704 builder
16781705 . start_gateway(
16791706 SwitchLocation :: Switch1 ,
1680- None ,
1707+ builder . mgs_listen_port ,
16811708 gateway_config_file,
16821709 )
16831710 . boxed( )
0 commit comments