diff options
author | 2020-12-21 05:30:24 -0500 | |
---|---|---|
committer | 2020-12-21 02:30:24 -0800 | |
commit | 51c05679e69dacd745db2b1eb33be04d7b626959 (patch) | |
tree | 6ec0071b8378f31a0d96eeea4061e58723be2d6d /plugin/kubernetes/informer_test.go | |
parent | 302434e3928219138313610c7faf9be5cc598129 (diff) | |
download | coredns-51c05679e69dacd745db2b1eb33be04d7b626959.tar.gz coredns-51c05679e69dacd745db2b1eb33be04d7b626959.tar.zst coredns-51c05679e69dacd745db2b1eb33be04d7b626959.zip |
plugin/kubernetes: Add support for dual stack ClusterIP Services (#4339)
* support dual stack clusterIPs
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
* stickler
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
* fix ClusterIPs make
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/kubernetes/informer_test.go')
-rw-r--r-- | plugin/kubernetes/informer_test.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/plugin/kubernetes/informer_test.go b/plugin/kubernetes/informer_test.go index 7aa9d1e83..ae68b5cfe 100644 --- a/plugin/kubernetes/informer_test.go +++ b/plugin/kubernetes/informer_test.go @@ -1,6 +1,7 @@ package kubernetes import ( + "fmt" "testing" "github.com/coredns/coredns/plugin/kubernetes/object" @@ -21,11 +22,19 @@ func TestDefaultProcessor(t *testing.T) { func testProcessor(t *testing.T, processor cache.ProcessFunc, idx cache.Indexer) { obj := &api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service1", Namespace: "test1"}, - Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{Port: 80}}}, + Spec: api.ServiceSpec{ + ClusterIP: "1.2.3.4", + ClusterIPs: []string{"1.2.3.4"}, + Ports: []api.ServicePort{{Port: 80}}, + }, } obj2 := &api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service2", Namespace: "test1"}, - Spec: api.ServiceSpec{ClusterIP: "5.6.7.8", Ports: []api.ServicePort{{Port: 80}}}, + Spec: api.ServiceSpec{ + ClusterIP: "5.6.7.8", + ClusterIPs: []string{"5.6.7.8"}, + Ports: []api.ServicePort{{Port: 80}}, + }, } // Add the objects @@ -47,8 +56,8 @@ func testProcessor(t *testing.T, processor cache.ProcessFunc, idx cache.Indexer) if !ok { t.Fatal("object in index was incorrect type") } - if svc.ClusterIP != obj.Spec.ClusterIP { - t.Fatalf("expected %v, got %v", obj.Spec.ClusterIP, svc.ClusterIP) + if fmt.Sprintf("%v", svc.ClusterIPs) != fmt.Sprintf("%v", obj.Spec.ClusterIPs) { + t.Fatalf("expected '%v', got '%v'", obj.Spec.ClusterIPs, svc.ClusterIPs) } // Update an object @@ -71,8 +80,8 @@ func testProcessor(t *testing.T, processor cache.ProcessFunc, idx cache.Indexer) if !ok { t.Fatal("object in index was incorrect type") } - if svc.ClusterIP != obj.Spec.ClusterIP { - t.Fatalf("expected %v, got %v", obj.Spec.ClusterIP, svc.ClusterIP) + if fmt.Sprintf("%v", svc.ClusterIPs) != fmt.Sprintf("%v", obj.Spec.ClusterIPs) { + t.Fatalf("expected '%v', got '%v'", obj.Spec.ClusterIPs, svc.ClusterIPs) } // Delete an object |