mw/federation: add federation back as separate mw for k8s (#929)
* mw/federaration This PR add the federation back as a middleware to keep it more contained from the main kubernetes code. It also makes parseRequest less import and pushes this functionlity down in the k.Entries. This minimizes (or tries to) the importance for the qtype in the query. In the end the qtype checking should only happen in ServeDNS - but for k8s this might proof difficult. Numerous other cleanup in code and kubernetes tests. * up test coverage
This commit is contained in:
parent
cc4e4a0626
commit
f96cf27193
25 changed files with 727 additions and 123 deletions
|
@ -4,11 +4,12 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/coredns/coredns/request"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func TestParseRequest(t *testing.T) {
|
||||
k := Kubernetes{Zones: []string{zone}}
|
||||
k := New([]string{zone})
|
||||
|
||||
tests := []struct {
|
||||
query string
|
||||
|
@ -30,10 +31,6 @@ func TestParseRequest(t *testing.T) {
|
|||
"1-2-3-4.webs.mynamespace.svc.inter.webs.test.", dns.TypeA,
|
||||
"..1-2-3-4.webs.mynamespace.svc.intern.webs.tests.",
|
||||
},
|
||||
{
|
||||
"inter.webs.test.", dns.TypeNS,
|
||||
"......intern.webs.tests.",
|
||||
},
|
||||
}
|
||||
for i, tc := range tests {
|
||||
m := new(dns.Msg)
|
||||
|
@ -52,7 +49,7 @@ func TestParseRequest(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestParseInvalidRequest(t *testing.T) {
|
||||
k := Kubernetes{Zones: []string{zone}}
|
||||
k := New([]string{zone})
|
||||
|
||||
invalid := map[string]uint16{
|
||||
"_http._tcp.webs.mynamespace.svc.inter.webs.test.": dns.TypeA, // A requests cannot have port or protocol
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue