make ignore empty work with ext svc types (#2823)

This commit is contained in:
Chris O'Haver 2019-05-07 20:31:50 -04:00 committed by John Belamaric
parent 6e1c57acfa
commit c147e20373
2 changed files with 11 additions and 1 deletions

View file

@ -439,7 +439,9 @@ func (k *Kubernetes) findServices(r recordRequest, zone string) (services []msg.
continue
}
if k.opts.ignoreEmptyService && svc.ClusterIP != api.ClusterIPNone {
// If "ignore empty_service" option is set and no endpoints exist, return NXDOMAIN unless
// it's a headless or externalName service (covered below).
if k.opts.ignoreEmptyService && svc.ClusterIP != api.ClusterIPNone && svc.Type != api.ServiceTypeExternalName {
// serve NXDOMAIN if no endpoint is able to answer
podsCount := 0
for _, ep := range endpointsListFunc() {