Commit fd4c5b57 authored by Chris O'Haver's avatar Chris O'Haver Committed by John Belamaric

Fix no PTR records response for cidr ranges (#506)

* set zone for cidr based PTRs

* set zone to request
parent dbe1b251
...@@ -26,12 +26,16 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M ...@@ -26,12 +26,16 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
// otherwise delegate to the next in the pipeline. // otherwise delegate to the next in the pipeline.
zone := middleware.Zones(k.Zones).Matches(state.Name()) zone := middleware.Zones(k.Zones).Matches(state.Name())
if zone == "" { if zone == "" {
if state.Type() == "PTR" {
// If this is a PTR request, and a the request is in a defined // If this is a PTR request, and a the request is in a defined
// pod/service cidr range, process the request in this middleware, // pod/service cidr range, process the request in this middleware,
// otherwise pass to next middleware. // otherwise pass to next middleware.
if state.Type() != "PTR" || !k.IsRequestInReverseRange(state) { if !k.IsRequestInReverseRange(state) {
return middleware.NextOrFailure(k.Name(), k.Next, ctx, w, r) return middleware.NextOrFailure(k.Name(), k.Next, ctx, w, r)
} }
// Set the zone to this specific request.
zone = state.Name()
}
} }
var ( var (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment