From 334a48ca110b937af000ea68e1c44540e1eb9ab1 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Mon, 2 Dec 2024 13:30:42 +0000 Subject: [PATCH] remove balancer ports from environmentd --- src/environmentd/src/environmentd/main.rs | 34 ----------- src/environmentd/src/lib.rs | 73 ----------------------- 2 files changed, 107 deletions(-) diff --git a/src/environmentd/src/environmentd/main.rs b/src/environmentd/src/environmentd/main.rs index e7fd62925913a..8ba5f7c9c75e9 100644 --- a/src/environmentd/src/environmentd/main.rs +++ b/src/environmentd/src/environmentd/main.rs @@ -162,30 +162,6 @@ pub struct Args { default_value = "127.0.0.1:6879" )] internal_persist_pubsub_listen_addr: SocketAddr, - /// The address on which to listen for SQL connections from the balancers. - /// - /// Connections to this address are not subject to encryption. - /// Care should be taken to not expose this address to the public internet - /// or other unauthorized parties. - #[clap( - long, - value_name = "HOST:PORT", - env = "BALANCER_SQL_LISTEN_ADDR", - default_value = "127.0.0.1:6880" - )] - balancer_sql_listen_addr: SocketAddr, - /// The address on which to listen for trusted HTTP connections. - /// - /// Connections to this address are not subject to encryption. - /// Care should be taken to not expose this address to the public internet - /// or other unauthorized parties. - #[clap( - long, - value_name = "HOST:PORT", - env = "BALANCER_HTTP_LISTEN_ADDR", - default_value = "127.0.0.1:6881" - )] - balancer_http_listen_addr: SocketAddr, /// Enable cross-origin resource sharing (CORS) for HTTP requests from the /// specified origin. /// @@ -1002,8 +978,6 @@ fn run(mut args: Args) -> Result<(), anyhow::Error> { let listeners = Listeners::bind(ListenersConfig { sql_listen_addr: args.sql_listen_addr, http_listen_addr: args.http_listen_addr, - balancer_sql_listen_addr: args.balancer_sql_listen_addr, - balancer_http_listen_addr: args.balancer_http_listen_addr, internal_sql_listen_addr: args.internal_sql_listen_addr, internal_http_listen_addr: args.internal_http_listen_addr, }) @@ -1109,14 +1083,6 @@ fn run(mut args: Args) -> Result<(), anyhow::Error> { " Internal HTTP address: {}", server.internal_http_local_addr() ); - println!( - " Balancerd SQL address: {}", - server.balancer_sql_local_addr() - ); - println!( - " Balancerd HTTP address: {}", - server.balancer_http_local_addr() - ); println!( " Internal Persist PubSub address: {}", args.internal_persist_pubsub_listen_addr diff --git a/src/environmentd/src/lib.rs b/src/environmentd/src/lib.rs index f9c213c25b03d..38e25d9671a8f 100644 --- a/src/environmentd/src/lib.rs +++ b/src/environmentd/src/lib.rs @@ -193,11 +193,6 @@ pub struct ListenersConfig { pub sql_listen_addr: SocketAddr, /// The IP address and port to listen for HTTP connections on. pub http_listen_addr: SocketAddr, - /// The IP address and port to listen on for pgwire connections from the cloud - /// balancer pods. - pub balancer_sql_listen_addr: SocketAddr, - /// The IP address and port to listen for HTTP connections from the cloud balancer pods. - pub balancer_http_listen_addr: SocketAddr, /// The IP address and port to listen for pgwire connections from the cloud /// system on. pub internal_sql_listen_addr: SocketAddr, @@ -219,8 +214,6 @@ pub struct Listeners { // Drop order matters for these fields. sql: (ListenerHandle, Pin>), http: (ListenerHandle, Pin>), - balancer_sql: (ListenerHandle, Pin>), - balancer_http: (ListenerHandle, Pin>), internal_sql: (ListenerHandle, Pin>), internal_http: (ListenerHandle, Pin>), } @@ -241,23 +234,17 @@ impl Listeners { ListenersConfig { sql_listen_addr, http_listen_addr, - balancer_sql_listen_addr, - balancer_http_listen_addr, internal_sql_listen_addr, internal_http_listen_addr, }: ListenersConfig, ) -> Result { let sql = mz_server_core::listen(&sql_listen_addr).await?; let http = mz_server_core::listen(&http_listen_addr).await?; - let balancer_sql = mz_server_core::listen(&balancer_sql_listen_addr).await?; - let balancer_http = mz_server_core::listen(&balancer_http_listen_addr).await?; let internal_sql = mz_server_core::listen(&internal_sql_listen_addr).await?; let internal_http = mz_server_core::listen(&internal_http_listen_addr).await?; Ok(Listeners { sql, http, - balancer_sql, - balancer_http, internal_sql, internal_http, }) @@ -269,8 +256,6 @@ impl Listeners { Listeners::bind(ListenersConfig { sql_listen_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), http_listen_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), - balancer_sql_listen_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), - balancer_http_listen_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), internal_sql_listen_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), internal_http_listen_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), }) @@ -289,8 +274,6 @@ impl Listeners { let Listeners { sql: (sql_listener, sql_conns), http: (http_listener, http_conns), - balancer_sql: (balancer_sql_listener, balancer_sql_conns), - balancer_http: (balancer_http_listener, balancer_http_conns), internal_sql: (internal_sql_listener, internal_sql_conns), internal_http: (internal_http_listener, internal_http_conns), } = self; @@ -761,50 +744,6 @@ impl Listeners { }) }); - // Launch HTTP server exposed to balancers - task::spawn(|| "balancer_http_server", { - let balancer_http_server = HttpServer::new(HttpConfig { - source: "balancer", - // TODO(Alex): implement self-signed TLS for all internal connections - tls: None, - frontegg: config.frontegg.clone(), - adapter_client: adapter_client.clone(), - allowed_origin: config.cors_allowed_origin, - active_connection_counter: active_connection_counter.clone(), - helm_chart_version: config.helm_chart_version.clone(), - concurrent_webhook_req: webhook_concurrency_limit.semaphore(), - metrics: http_metrics, - }); - mz_server_core::serve(ServeConfig { - conns: balancer_http_conns, - server: balancer_http_server, - // `environmentd` does not currently need to dynamically - // configure graceful termination behavior. - dyncfg: None, - }) - }); - - // Launch SQL server exposed to balancers - task::spawn(|| "balancer_sql_server", { - let balancer_sql_server = mz_pgwire::Server::new(mz_pgwire::Config { - label: "balancer_pgwire", - tls: None, - adapter_client: adapter_client.clone(), - frontegg: config.frontegg.clone(), - metrics, - internal: false, - active_connection_counter: active_connection_counter.clone(), - helm_chart_version: config.helm_chart_version.clone(), - }); - mz_server_core::serve(ServeConfig { - conns: balancer_sql_conns, - server: balancer_sql_server, - // `environmentd` does not currently need to dynamically - // configure graceful termination behavior. - dyncfg: None, - }) - }); - // Start telemetry reporting loop. if let Some(segment_client) = segment_client { telemetry::start_reporting(telemetry::Config { @@ -840,8 +779,6 @@ impl Listeners { Ok(Server { sql_listener, http_listener, - balancer_sql_listener, - balancer_http_listener, internal_sql_listener, internal_http_listener, _adapter_handle: adapter_handle, @@ -884,8 +821,6 @@ pub struct Server { // Drop order matters for these fields. sql_listener: ListenerHandle, http_listener: ListenerHandle, - balancer_sql_listener: ListenerHandle, - balancer_http_listener: ListenerHandle, internal_sql_listener: ListenerHandle, internal_http_listener: ListenerHandle, _adapter_handle: mz_adapter::Handle, @@ -900,14 +835,6 @@ impl Server { self.http_listener.local_addr() } - pub fn balancer_sql_local_addr(&self) -> SocketAddr { - self.balancer_sql_listener.local_addr() - } - - pub fn balancer_http_local_addr(&self) -> SocketAddr { - self.balancer_http_listener.local_addr() - } - pub fn internal_sql_local_addr(&self) -> SocketAddr { self.internal_sql_listener.local_addr() }