dont match external services when endpoint is specified (#5734)

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Chris O'Haver 2022-11-04 09:54:57 -04:00 committed by GitHub
parent ead84e1fa8
commit 47c99dc73b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 8 deletions

View file

@ -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}, "/")