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

@ -20,7 +20,6 @@ type recordRequest struct {
// A each name can be for a pod or a service, here we track what we've seen. This value is true for
// pods and false for services. If we ever need to extend this well use a typed value.
podOrSvc string
zone string
}
// parseRequest parses the qname to find all the elements we need for querying k8s.
@ -34,8 +33,6 @@ func (k *Kubernetes) parseRequest(state request.Request) (r recordRequest, err e
base, _ := dnsutil.TrimZone(state.Name(), state.Zone)
segs := dns.SplitDomainName(base)
r.zone = state.Zone
offset := 0
if state.QType() == dns.TypeSRV {
// The kubernetes peer-finder expects queries with empty port and service to resolve
@ -101,6 +98,5 @@ func (r recordRequest) String() string {
s += "." + r.service
s += "." + r.namespace
s += "." + r.podOrSvc
s += "." + r.zone
return s
}