Fix k8s chaining (#510)
* fix k8s next middleware chaining * add chain to integration tests * if nit
This commit is contained in:
parent
fa1c90a479
commit
353c1c6487
2 changed files with 40 additions and 9 deletions
|
@ -26,16 +26,17 @@ 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 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()
|
||||
if state.Type() != "PTR" {
|
||||
return middleware.NextOrFailure(k.Name(), k.Next, ctx, w, r)
|
||||
}
|
||||
// If this is a PTR request, and 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()
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue