mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
kubernetes: add multicluster support (#7266)
* kubernetes: add multicluster support Add multicluster support via Multi-Cluster Services API (MCS-API) via a new option `multiclusterZones` in the kubernetes plugin. When some multicluster zones are passed to the kubernetes plugin, it will start watching the ServiceImport objects and its associated EndpointSlices. Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> * kubernetes: implement xfr support for multicluster zones Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
This commit is contained in:
committed by
GitHub
parent
76b199f829
commit
5c71bd0b87
@@ -2,6 +2,7 @@ package kubernetes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/coredns/coredns/plugin/metadata"
|
||||
@@ -81,6 +82,19 @@ var metadataCases = []struct {
|
||||
"kubernetes/service": "s",
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "ep.c1.s.ns.svc.clusterset.local.", Qtype: dns.TypeA,
|
||||
RemoteIP: "10.10.10.10",
|
||||
Md: map[string]string{
|
||||
"kubernetes/cluster": "c1",
|
||||
"kubernetes/endpoint": "ep",
|
||||
"kubernetes/kind": "svc",
|
||||
"kubernetes/namespace": "ns",
|
||||
"kubernetes/port-name": "",
|
||||
"kubernetes/protocol": "",
|
||||
"kubernetes/service": "s",
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "example.com.", Qtype: dns.TypeA,
|
||||
RemoteIP: "10.10.10.10",
|
||||
@@ -103,14 +117,19 @@ func mapsDiffer(a, b map[string]string) bool {
|
||||
}
|
||||
|
||||
func TestMetadata(t *testing.T) {
|
||||
k := New([]string{"cluster.local."})
|
||||
k := New([]string{"cluster.local.", "clusterset.local."})
|
||||
k.opts.multiclusterZones = []string{"clusterset.local."}
|
||||
k.APIConn = &APIConnServeTest{}
|
||||
|
||||
for i, tc := range metadataCases {
|
||||
ctx := metadata.ContextWithMetadata(context.Background())
|
||||
zone := "."
|
||||
if strings.Contains(tc.Qname, "clusterset.local") {
|
||||
zone = "clusterset.local."
|
||||
}
|
||||
state := request.Request{
|
||||
Req: &dns.Msg{Question: []dns.Question{{Name: tc.Qname, Qtype: tc.Qtype}}},
|
||||
Zone: ".",
|
||||
Zone: zone,
|
||||
W: &test.ResponseWriter{RemoteIP: tc.RemoteIP},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user