diff options
author | 2017-08-18 14:45:20 +0100 | |
---|---|---|
committer | 2017-08-18 14:45:20 +0100 | |
commit | f96cf27193032120ba727316c4057dffed0cbe48 (patch) | |
tree | c76caa111aba281560a3b7db91953e307c06f1c9 /middleware/kubernetes/parse.go | |
parent | cc4e4a0626bf8881e2ae8b2c1e52e09c6308e74e (diff) | |
download | coredns-f96cf27193032120ba727316c4057dffed0cbe48.tar.gz coredns-f96cf27193032120ba727316c4057dffed0cbe48.tar.zst coredns-f96cf27193032120ba727316c4057dffed0cbe48.zip |
mw/federation: add federation back as separate mw for k8s (#929)
* mw/federaration
This PR add the federation back as a middleware to keep it more
contained from the main kubernetes code.
It also makes parseRequest less import and pushes this functionlity down
in the k.Entries. This minimizes (or tries to) the importance for the
qtype in the query. In the end the qtype checking should only happen
in ServeDNS - but for k8s this might proof difficult.
Numerous other cleanup in code and kubernetes tests.
* up test coverage
Diffstat (limited to 'middleware/kubernetes/parse.go')
-rw-r--r-- | middleware/kubernetes/parse.go | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/middleware/kubernetes/parse.go b/middleware/kubernetes/parse.go index c582f904e..c7d614ec1 100644 --- a/middleware/kubernetes/parse.go +++ b/middleware/kubernetes/parse.go @@ -25,24 +25,17 @@ type recordRequest struct { // parseRequest parses the qname to find all the elements we need for querying k8s. func (k *Kubernetes) parseRequest(state request.Request) (r recordRequest, err error) { - // 3 Possible cases: TODO(chris): remove federations comments here. - // SRV Request: _port._protocol.service.namespace.[federation.]type.zone - // A Request (endpoint): endpoint.service.namespace.[federation.]type.zone - // A Request (service): service.namespace.[federation.]type.zone + // 3 Possible cases: + // o SRV Request: _port._protocol.service.namespace.type.zone + // o A Request (endpoint): endpoint.service.namespace.type.zone + // o A Request (service): service.namespace.type.zone + // Federations are handled in the federation middleware. base, _ := dnsutil.TrimZone(state.Name(), state.Zone) segs := dns.SplitDomainName(base) r.zone = state.Zone - if state.QType() == dns.TypeNS { - return r, nil - } - - if state.QType() == dns.TypeA && isDefaultNS(state.Name(), r) { - return r, nil - } - offset := 0 if state.QType() == dns.TypeSRV { // The kubernetes peer-finder expects queries with empty port and service to resolve @@ -99,8 +92,7 @@ func (k *Kubernetes) parseRequest(state request.Request) (r recordRequest, err e return r, errInvalidRequest } -// String return a string representation of r, it just returns all -// fields concatenated with dots. +// String return a string representation of r, it just returns all fields concatenated with dots. // This is mostly used in tests. func (r recordRequest) String() string { s := r.port |