diff --git a/control-plane/src/main.rs b/control-plane/src/main.rs index bc0077ec..4bdaeb6b 100644 --- a/control-plane/src/main.rs +++ b/control-plane/src/main.rs @@ -63,74 +63,38 @@ async fn main() -> Result<()> { let config_server = config_server::ConfigServer::new(cert_provisioner_client, acme_s3_client); - #[cfg(not(feature = "network_egress"))] - { - listen_for_shutdown_signal(); - - tokio::spawn(e3_proxy.listen()); - - tokio::spawn(tcp_server()); + listen_for_shutdown_signal(); - tokio::spawn(StatsProxy::listen()); + tokio::spawn(e3_proxy.listen()); - tokio::spawn(Orchestration::start_enclave()); + tokio::spawn(StatsProxy::listen()); - tokio::spawn(HealthCheckServer::start()); - - tokio::spawn(async move { - if let Err(e) = config_server.listen().await { - log::error!("Error running config server on host: {e:?}"); - } - }); + tokio::spawn(HealthCheckServer::start()); - tokio::spawn(acme_proxy.listen()); + tokio::spawn(provisioner_proxy.listen()); - let (provisioner_proxy_result,) = tokio::join!(provisioner_proxy.listen(),); + tokio::spawn(acme_proxy.listen()); - if let Err(err) = provisioner_proxy_result { - log::error!("Error running provisioner proxy on host: {err:?}"); + tokio::spawn(async move { + if let Err(e) = config_server.listen().await { + log::error!("Error starting config server - {e:?}"); } - } + }); #[cfg(feature = "network_egress")] { - listen_for_shutdown_signal(); let parsed_ip = control_plane::dnsproxy::read_dns_server_ips_from_env_var() .unwrap_or_else(|| control_plane::dnsproxy::DNS_SERVERS.clone()); let dns_proxy_server = control_plane::dnsproxy::DnsProxy::new(parsed_ip); - tokio::spawn(HealthCheckServer::start()); - tokio::spawn(dns_proxy_server.listen()); tokio::spawn(control_plane::egressproxy::EgressProxy::listen()); - - tokio::spawn(e3_proxy.listen()); - - tokio::spawn(tcp_server()); - - tokio::spawn(StatsProxy::listen()); - - tokio::spawn(Orchestration::start_enclave()); - - tokio::spawn(HealthCheckServer::start()); - - tokio::spawn(async move { - if let Err(e) = config_server.listen().await { - log::error!("Error running config server on host: {e:?}"); - } - }); - - tokio::spawn(acme_proxy.listen()); - - let (provisioner_proxy_result,) = tokio::join!(provisioner_proxy.listen(),); - - if let Err(err) = provisioner_proxy_result { - log::error!("Error running provisioner proxy on host: {err:?}"); - } } - Ok(()) + tokio::spawn(Orchestration::start_enclave()); + + tcp_server().await } async fn tcp_server() -> Result<()> {