mw/kubernetes: remove federation and cidr (#916)
* mw/kubernetes: remove federation and cidr Remove both as we have a corefile syntax change that handles cidr and remove federation because that is going to be its own middleware. * backwards incompat changes This PR: * removes cidr from kubernetes (core Corefile feature now) * removes federation from kubernets (comes back as new middleware) * [remove autopath - which was already gone, so that already was backwards incompat] * adds `fallthrough` to the *etcd* middleware and makes you enable it. * Fail on unknown properties * documentation * Disable TestHealthCheck as it uses realtime and fails
This commit is contained in:
parent
818d2b10ad
commit
00f5c7797e
26 changed files with 197 additions and 815 deletions
|
@ -3,6 +3,8 @@
|
|||
package test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -13,6 +15,10 @@ import (
|
|||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
}
|
||||
|
||||
// Test data
|
||||
// TODO: Fix the actual RR values
|
||||
|
||||
|
@ -218,25 +224,6 @@ var dnsTestCases = []test.Case{
|
|||
Rcode: dns.RcodeServerFailure,
|
||||
Answer: []dns.RR{},
|
||||
},
|
||||
{
|
||||
Qname: "123.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{},
|
||||
},
|
||||
{
|
||||
Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "115.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-c.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "dns-version.cluster.local.", Qtype: dns.TypeTXT,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
|
@ -244,13 +231,6 @@ var dnsTestCases = []test.Case{
|
|||
test.TXT("dns-version.cluster.local. 28800 IN TXT \"1.0.0\""),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "next-in-chain.", Qtype: dns.TypeA,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.A("next-in-chain. 0 IN A 192.0.2.53"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "cluster.local.", Qtype: dns.TypeNS,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
|
@ -303,80 +283,6 @@ var dnsTestCasesPodsVerified = []test.Case{
|
|||
},
|
||||
}
|
||||
|
||||
var dnsTestCasesCidrReverseZone = []test.Case{
|
||||
{
|
||||
Qname: "123.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{},
|
||||
},
|
||||
{
|
||||
Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "110.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-1-b.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "115.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-c.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "next-in-chain.", Qtype: dns.TypeA,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.A("next-in-chain. 0 IN A 192.0.2.53"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var dnsTestCasesPartialCidrReverseZone = []test.Case{
|
||||
{
|
||||
// In exposed range, record not present = OK + No data
|
||||
Qname: "99.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{},
|
||||
},
|
||||
{
|
||||
// In exposed range, record present = OK + Data
|
||||
Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
// In exposed range, record present = OK + Data
|
||||
Qname: "110.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-1-b.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
// Out of exposed range, record present = pass to next middleware (not existing in test) = FAIL
|
||||
Qname: "115.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeServerFailure,
|
||||
Answer: []dns.RR{},
|
||||
},
|
||||
{
|
||||
Qname: "next-in-chain.", Qtype: dns.TypeA,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.A("next-in-chain. 0 IN A 192.0.2.53"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var dnsTestCasesAllNSExposed = []test.Case{
|
||||
{
|
||||
Qname: "svc-1-a.test-1.svc.cluster.local.", Qtype: dns.TypeA,
|
||||
|
@ -392,25 +298,6 @@ var dnsTestCasesAllNSExposed = []test.Case{
|
|||
test.A("svc-c.test-1.svc.cluster.local. 303 IN A 10.0.0.120"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "123.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{},
|
||||
},
|
||||
{
|
||||
Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "120.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR,
|
||||
Rcode: dns.RcodeSuccess,
|
||||
Answer: []dns.RR{
|
||||
test.PTR("120.0.0.10.in-addr.arpa. 303 IN PTR svc-c.test-2.svc.cluster.local."),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var dnsTestCasesFallthrough = []test.Case{
|
||||
|
@ -558,42 +445,11 @@ func TestKubernetesIntegrationPodsVerified(t *testing.T) {
|
|||
doIntegrationTests(t, corefile, dnsTestCasesPodsVerified)
|
||||
}
|
||||
|
||||
func TestKubernetesIntegrationCidrReverseZone(t *testing.T) {
|
||||
corefile :=
|
||||
`.:0 {
|
||||
kubernetes cluster.local {
|
||||
endpoint http://localhost:8080
|
||||
namespaces test-1
|
||||
cidrs 10.0.0.0/24
|
||||
}
|
||||
erratic . {
|
||||
drop 0
|
||||
}
|
||||
`
|
||||
doIntegrationTests(t, corefile, dnsTestCasesCidrReverseZone)
|
||||
}
|
||||
|
||||
func TestKubernetesIntegrationPartialCidrReverseZone(t *testing.T) {
|
||||
corefile :=
|
||||
`.:0 {
|
||||
kubernetes cluster.local {
|
||||
endpoint http://localhost:8080
|
||||
namespaces test-1
|
||||
cidrs 10.0.0.96/28 10.0.0.120/32
|
||||
}
|
||||
erratic . {
|
||||
drop 0
|
||||
}
|
||||
`
|
||||
doIntegrationTests(t, corefile, dnsTestCasesPartialCidrReverseZone)
|
||||
}
|
||||
|
||||
func TestKubernetesIntegrationAllNSExposed(t *testing.T) {
|
||||
corefile :=
|
||||
`.:0 {
|
||||
kubernetes cluster.local {
|
||||
endpoint http://localhost:8080
|
||||
cidrs 10.0.0.0/24
|
||||
}
|
||||
`
|
||||
doIntegrationTests(t, corefile, dnsTestCasesAllNSExposed)
|
||||
|
@ -615,7 +471,6 @@ func TestKubernetesIntegrationFallthrough(t *testing.T) {
|
|||
file ` + dbfile + ` cluster.local
|
||||
kubernetes cluster.local {
|
||||
endpoint http://localhost:8080
|
||||
cidrs 10.0.0.0/24
|
||||
namespaces test-1
|
||||
upstream ` + udp + `
|
||||
fallthrough
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue