diff options
author | 2017-02-07 13:58:52 -0500 | |
---|---|---|
committer | 2017-02-07 13:58:52 -0500 | |
commit | fd4c5b57443a2177c8c46f0625e7c0cce24fdbbf (patch) | |
tree | a516af87ef2e83ced990b6dfc4c59f435384ef2e /middleware/kubernetes/handler.go | |
parent | dbe1b2510d609bf37b0874f0aafa91e982cdc5c2 (diff) | |
download | coredns-fd4c5b57443a2177c8c46f0625e7c0cce24fdbbf.tar.gz coredns-fd4c5b57443a2177c8c46f0625e7c0cce24fdbbf.tar.zst coredns-fd4c5b57443a2177c8c46f0625e7c0cce24fdbbf.zip |
Fix no PTR records response for cidr ranges (#506)
* set zone for cidr based PTRs
* set zone to request
Diffstat (limited to 'middleware/kubernetes/handler.go')
-rw-r--r-- | middleware/kubernetes/handler.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/middleware/kubernetes/handler.go b/middleware/kubernetes/handler.go index 12277911a..3efe6e722 100644 --- a/middleware/kubernetes/handler.go +++ b/middleware/kubernetes/handler.go @@ -26,11 +26,15 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M // otherwise delegate to the next in the pipeline. zone := middleware.Zones(k.Zones).Matches(state.Name()) if zone == "" { - // If this is a PTR request, and a the request is in a defined - // pod/service cidr range, process the request in this middleware, - // otherwise pass to next middleware. - if state.Type() != "PTR" || !k.IsRequestInReverseRange(state) { - return middleware.NextOrFailure(k.Name(), k.Next, ctx, w, r) + if state.Type() == "PTR" { + // If this is a PTR request, and a the request is in a defined + // pod/service cidr range, process the request in this middleware, + // otherwise pass to next middleware. + if !k.IsRequestInReverseRange(state) { + return middleware.NextOrFailure(k.Name(), k.Next, ctx, w, r) + } + // Set the zone to this specific request. + zone = state.Name() } } |