dont match external services when endpoint is specified (#5734)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
ead84e1fa8
commit
47c99dc73b
2 changed files with 20 additions and 8 deletions
|
@ -384,6 +384,14 @@ var dnsTestCases = []kubeTestCase{
|
|||
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 an external service should not resolve to the external service
|
||||
{Case: test.Case{
|
||||
Qname: "endpoint.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) {
|
||||
|
|
|
@ -517,6 +517,10 @@ func (k *Kubernetes) findServices(r recordRequest, zone string) (services []msg.
|
|||
|
||||
// External service
|
||||
if svc.Type == api.ServiceTypeExternalName {
|
||||
//External services cannot have endpoints, so skip this service if an endpoint is present in the request
|
||||
if r.endpoint != "" {
|
||||
continue
|
||||
}
|
||||
s := msg.Service{Key: strings.Join([]string{zonePath, Svc, svc.Namespace, svc.Name}, "/"), Host: svc.ExternalName, TTL: k.ttl}
|
||||
if t, _ := s.HostType(); t == dns.TypeCNAME {
|
||||
s.Key = strings.Join([]string{zonePath, Svc, svc.Namespace, svc.Name}, "/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue