From f96cf27193032120ba727316c4057dffed0cbe48 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 18 Aug 2017 14:45:20 +0100 Subject: 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 --- middleware/kubernetes/parse_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'middleware/kubernetes/parse_test.go') diff --git a/middleware/kubernetes/parse_test.go b/middleware/kubernetes/parse_test.go index 951a47554..0a3d224e4 100644 --- a/middleware/kubernetes/parse_test.go +++ b/middleware/kubernetes/parse_test.go @@ -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 -- cgit v1.2.3