From 2fb997d3d081c143683e9c8214ed071ccfa56f60 Mon Sep 17 00:00:00 2001 From: Anders Roos Date: Tue, 21 Mar 2023 17:27:12 +0100 Subject: [PATCH] Workaround for an issue in the quilkin proxy. The proxy makes dns lookups that slows down proxying. This patch makes dns lookups in the manager instead, sending ips to the proxy instance so it does not have to do lookups. --- src/config/providers/k8s/agones.rs | 4 +++- src/endpoint/address.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/providers/k8s/agones.rs b/src/config/providers/k8s/agones.rs index 7bf4193667..f71a77d341 100644 --- a/src/config/providers/k8s/agones.rs +++ b/src/config/providers/k8s/agones.rs @@ -14,6 +14,7 @@ * limitations under the License. */ +use std::net::ToSocketAddrs; use k8s_openapi::{ apiextensions_apiserver::pkg::apis::apiextensions::v1::{ CustomResourceDefinition, CustomResourceDefinitionNames, CustomResourceDefinitionSpec, @@ -272,8 +273,9 @@ impl TryFrom for Endpoint { .as_ref() .and_then(|ports| ports.first().map(|status| status.port)) .unwrap_or_default(); + let socket_address = (address, port).to_socket_addrs()?.next().unwrap(); let filter_metadata = crate::endpoint::Metadata { tokens }; - Ok(Self::with_metadata((address, port).into(), filter_metadata)) + Ok(Self::with_metadata(socket_address.into(), filter_metadata)) } } diff --git a/src/endpoint/address.rs b/src/endpoint/address.rs index 1026e46193..3d147d196f 100644 --- a/src/endpoint/address.rs +++ b/src/endpoint/address.rs @@ -64,7 +64,7 @@ impl EndpointAddress { Ok(if let Some(port) = self.port { match &self.host { AddressKind::Ip(ip) => (*ip, port).to_socket_addrs()?.next().unwrap(), - AddressKind::Name(name) => (&**name, port).to_socket_addrs()?.next().unwrap(), + AddressKind::Name(name) => (&**name, port).to_socket_addrs()?.next().unwrap(), // The real issue originates from here, dns lookup makes proxying slow. } } else { match &self.host {