diff --git a/swarm-controller/src/main.rs b/swarm-controller/src/main.rs index 11398f4ab..dd3e78373 100644 --- a/swarm-controller/src/main.rs +++ b/swarm-controller/src/main.rs @@ -271,14 +271,7 @@ async fn main() -> Result<()> { reviews: Arc::default(), alerts: alerts::from_env(), }; - serve( - listener, - tcp_tls::TcpTlsConfig::from_env()?, - state, - stop, - health, - ) - .await + serve(listener, state, stop, health).await } /// The value a startup step produced, or exit 0 when the stop signal ended the @@ -327,18 +320,19 @@ fn register_cert_gauges(provider: Option<&opentelemetry_sdk::metrics::SdkMeterPr } /// Start taking the queued review requests and answering the notification -/// router's, then serve `state` on `listener`, and on `tcp` too when it is -/// configured, until `stop` resolves. Both answer from the same router and -/// both drain on `stop`. The requests in hand finish for at most the drain; +/// router's, then serve `state` on `listener`, and on the TCP listener too when +/// its environment is configured (a half-set one refuses to start, before +/// anything is served), until `stop` resolves. Both answer from the same router +/// and both drain on `stop`. The requests in hand finish for at most the drain; /// the review queue takes no request after `stop`. `health` answers `/readyz` /// as the socket's does. async fn serve( listener: tokio::net::UnixListener, - tcp: Option, state: AppState, stop: impl Future + Clone + Send + 'static, health: swarm_secret_client::health::Health, ) -> Result<()> { + let tcp = tcp_tls::TcpTlsConfig::from_env()?; let store = routes::watch_store(); health.ready_when(routes::probe_condition(state.status.clone(), store)); review_classifier::review::spawn_queue(&state, stop.clone());