mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	plugin/kubernetes: filter ExternalName services from matching double subdomain wildcard (#6162)
remove double subdomain reference from review feedback not subdoman Signed-off-by: emaildanwilson <dan@controlplane.com> Co-authored-by: emaildanwilson <dan@controlplane.com>
This commit is contained in:
		| @@ -408,6 +408,14 @@ var dnsTestCases = []kubeTestCase{ | |||||||
| 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||||
| 		}, | 		}, | ||||||
| 	}}, | 	}}, | ||||||
|  | 	// A query for a subdomain of a subdomain of an external service should not resolve to the external service | ||||||
|  | 	{Case: test.Case{ | ||||||
|  | 		Qname: "subdomain.subdomain.external.testns.svc.cluster.local.", Qtype: dns.TypeCNAME, | ||||||
|  | 		Rcode: dns.RcodeNameError, | ||||||
|  | 		Ns: []dns.RR{ | ||||||
|  | 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||||
|  | 		}, | ||||||
|  | 	}}, | ||||||
| } | } | ||||||
|  |  | ||||||
| func TestServeDNS(t *testing.T) { | func TestServeDNS(t *testing.T) { | ||||||
|   | |||||||
| @@ -445,8 +445,8 @@ func (k *Kubernetes) findServices(r recordRequest, zone string) (services []msg. | |||||||
|  |  | ||||||
| 		// External service | 		// External service | ||||||
| 		if svc.Type == api.ServiceTypeExternalName { | 		if svc.Type == api.ServiceTypeExternalName { | ||||||
| 			//External services cannot have endpoints, so skip this service if an endpoint is present in the request | 			// External services do not have endpoints, nor can we accept port/protocol pseudo subdomains in an SRV query, so skip this service if endpoint, port, or protocol is non-empty in the request | ||||||
| 			if r.endpoint != "" { | 			if r.endpoint != "" || r.port != "" || r.protocol != "" { | ||||||
| 				continue | 				continue | ||||||
| 			} | 			} | ||||||
| 			s := msg.Service{Key: strings.Join([]string{zonePath, Svc, svc.Namespace, svc.Name}, "/"), Host: svc.ExternalName, TTL: k.ttl} | 			s := msg.Service{Key: strings.Join([]string{zonePath, Svc, svc.Namespace, svc.Name}, "/"), Host: svc.ExternalName, TTL: k.ttl} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user