diff --git a/src/dns/server.rs b/src/dns/server.rs index 68f7e0343..5eb2b4ed2 100644 --- a/src/dns/server.rs +++ b/src/dns/server.rs @@ -387,14 +387,8 @@ impl Store { name: search_name, alias, }); - } else if let Some(wl) = state.workloads.find_hostname(&search_name_str) { - // Didn't find a service, try a workload. - return Some(ServerMatch { - server: Address::Workload(wl), - name: search_name, - alias, - }); } + // TODO(): add support for workload lookups for headless pods } } @@ -1219,18 +1213,20 @@ mod tests { a(n("headless.ns1.svc.cluster.local."), ipv4("31.31.31.31"))], ..Default::default() }, + // TODO(https://github.com/istio/ztunnel/issues/1119) Case { - name: "success: k8s pod - fqdn", + name: "todo: k8s pod - fqdn", host: "headless.pod0.ns1.svc.cluster.local.", - expect_records: vec![ - a(n("headless.pod0.ns1.svc.cluster.local."), ipv4("30.30.30.30"))], + expect_authoritative: false, // forwarded. + expect_code: ResponseCode::NXDomain, ..Default::default() }, + // TODO(https://github.com/istio/ztunnel/issues/1119) Case { - name: "success: k8s pod - name.domain.ns", + name: "todo: k8s pod - name.domain.ns", host: "headless.pod0.ns1.", - expect_records: vec![ - a(n("headless.pod0.ns1."), ipv4("30.30.30.30"))], + expect_authoritative: false, // forwarded. + expect_code: ResponseCode::NXDomain, ..Default::default() }, Case { diff --git a/src/state.rs b/src/state.rs index 4a3525eeb..f338223f6 100644 --- a/src/state.rs +++ b/src/state.rs @@ -235,15 +235,11 @@ impl ProxyState { pub fn find_hostname(&self, name: &NamespacedHostname) -> Option
{ // Hostnames for services are more common, so lookup service first and fallback // to workload. - match self.services.get_by_namespaced_host(name) { - None => { - // Workload hostnames are globally unique, so ignore the namespace. - self.workloads - .find_hostname(&name.hostname) - .map(Address::Workload) - } - Some(svc) => Some(Address::Service(svc)), - } + // We do not looking up workloads by hostname. We could, but we only allow referencing "frontends", + // not backends + self.services + .get_by_namespaced_host(name) + .map(Address::Service) } fn find_upstream( diff --git a/src/state/workload.rs b/src/state/workload.rs index d6faaba1e..f655d25a3 100644 --- a/src/state/workload.rs +++ b/src/state/workload.rs @@ -601,8 +601,6 @@ pub struct WorkloadStore { by_addr: HashMap