Fix k8s PTR when all namespaces exposed (#507)

* check for no namespace filter

* integration test
This commit is contained in:
Chris O'Haver 2017-02-07 16:22:43 -05:00 committed by John Belamaric
parent 89dc5720d0
commit 4b6860fc81
2 changed files with 49 additions and 2 deletions

View file

@ -508,7 +508,7 @@ func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service {
return nil
}
for _, service := range svcList {
if !dnsstrings.StringInSlice(service.Namespace, k.Namespaces) {
if (len(k.Namespaces) > 0) && !dnsstrings.StringInSlice(service.Namespace, k.Namespaces) {
continue
}
if service.Spec.ClusterIP == ip {
@ -522,7 +522,7 @@ func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service {
return nil
}
for _, ep := range epList.Items {
if !dnsstrings.StringInSlice(ep.ObjectMeta.Namespace, k.Namespaces) {
if (len(k.Namespaces) > 0) && !dnsstrings.StringInSlice(ep.ObjectMeta.Namespace, k.Namespaces) {
continue
}
for _, eps := range ep.Subsets {