mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
CIDR query routing (#1159)
* core: allow all CIDR ranges in zone specifications Allow (e.g.) a v4 reverse on a /17. If a zone is specified in such a way a FilterFunc is set in the config. This filter is checked against incoming queries. For all other queries this adds a 'x != nil' check which will not impact performace too much. Benchmark function is added as well to check for this as wel. Add multiple tests in tests/server_reverse_test.go. Benchmark shows in the non-reverse case this hardly impact the speed: ~~~ classless: pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1431 ns/op 16 B/op 1 allocs/op pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op master: pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1412 ns/op 16 B/op 1 allocs/op pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op ~~~ * README.md updates
This commit is contained in:
@@ -76,13 +76,12 @@ kubernetes [ZONES...] {
|
||||
|
||||
## Examples
|
||||
|
||||
Handle all queries in the `cluster.local` zone. Connect to Kubernetes in-cluster.
|
||||
Also handle all `PTR` requests for `10.0.0.0/16` . Verify the existence of pods when answering pod
|
||||
requests. Resolve upstream records against `10.102.3.10`. Note we show the entire server block
|
||||
here:
|
||||
Handle all queries in the `cluster.local` zone. Connect to Kubernetes in-cluster. Also handle all
|
||||
`in-addr.arpa` `PTR` requests for `10.0.0.0/17` . Verify the existence of pods when answering pod
|
||||
requests. Resolve upstream records against `10.102.3.10`. Note we show the entire server block here:
|
||||
|
||||
~~~ txt
|
||||
10.0.0.0/16 cluster.local {
|
||||
10.0.0.0/17 cluster.local {
|
||||
kubernetes {
|
||||
pods verified
|
||||
upstream 10.102.3.10:53
|
||||
|
||||
@@ -12,7 +12,7 @@ func TestKubernetesParseReverseZone(t *testing.T) {
|
||||
expectedZones []string // expected count of defined zones.
|
||||
}{
|
||||
{`kubernetes coredns.local 10.0.0.0/16`, []string{"coredns.local.", "0.10.in-addr.arpa."}},
|
||||
{`kubernetes coredns.local 10.0.0.0/17`, []string{"coredns.local.", "10.0.0.0/17."}},
|
||||
{`kubernetes coredns.local 10.0.0.0/17`, []string{"coredns.local.", "0.10.in-addr.arpa."}},
|
||||
}
|
||||
|
||||
for i, tc := range tests {
|
||||
|
||||
Reference in New Issue
Block a user