mw/kubernetes: remove zone from parseRequest (#938)

* mw/kubernetes: remove zone from parseRequest

State has the zone info as well, so don't need to have it in
parseRequest anymore.

* Fix up tests

* improve test coverage
This commit is contained in:
Miek Gieben 2017-08-19 07:18:35 +01:00 committed by GitHub
parent f96cf27193
commit 627687b11f
3 changed files with 12 additions and 10 deletions

View file

@ -315,7 +315,7 @@ func (k *Kubernetes) Entries(state request.Request) ([]msg.Service, error) {
return nil, errNoItems
}
records := k.getRecordsForK8sItems(services, pods, r)
records := k.getRecordsForK8sItems(services, pods, state.Zone)
return records, nil
}
@ -332,8 +332,8 @@ func endpointHostname(addr api.EndpointAddress) string {
return ""
}
func (k *Kubernetes) getRecordsForK8sItems(services []kService, pods []kPod, r recordRequest) (records []msg.Service) {
zonePath := msg.Path(r.zone, "coredns")
func (k *Kubernetes) getRecordsForK8sItems(services []kService, pods []kPod, zone string) (records []msg.Service) {
zonePath := msg.Path(zone, "coredns")
for _, svc := range services {
if svc.addr == api.ClusterIPNone || len(svc.endpoints) > 0 {