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

@ -3,6 +3,7 @@ package kubernetes
import (
"errors"
"fmt"
"net"
"strings"
"time"
@ -84,6 +85,20 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) {
for c.NextBlock() {
switch c.Val() {
case "cidrs":
args := c.RemainingArgs()
if len(args) > 0 {
for _, cidrStr := range args {
_, cidr, err := net.ParseCIDR(cidrStr)
if err != nil {
return nil, errors.New(c.Val() + " contains an invalid cidr: " + cidrStr)
}
k8s.ReverseCidrs = append(k8s.ReverseCidrs, *cidr)
}
continue
}
return nil, c.ArgErr()
case "pods":
args := c.RemainingArgs()
if len(args) == 1 {