Allow cidr based reverse zone config (#500)

* add cidrs opt

* remove state data from middleware object
This commit is contained in:
Chris O'Haver 2017-02-01 12:56:10 -05:00 committed by John Belamaric
parent 3a04d2a306
commit 8beb1b2166
3 changed files with 33 additions and 1 deletions

View file

@ -26,7 +26,12 @@ 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 == "" {
return middleware.NextOrFailure(k.Name(), k.Next, ctx, w, r)
// 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)
}
}
var (