aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/handler_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/kubernetes/handler_test.go')
-rw-r--r--plugin/kubernetes/handler_test.go82
1 files changed, 58 insertions, 24 deletions
diff --git a/plugin/kubernetes/handler_test.go b/plugin/kubernetes/handler_test.go
index f5630ccdd..71609a6de 100644
--- a/plugin/kubernetes/handler_test.go
+++ b/plugin/kubernetes/handler_test.go
@@ -372,6 +372,30 @@ var dnsTestCases = []test.Case{
test.SOA("cluster.local. 5 IN SOA ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"),
},
},
+ // Dual Stack ClusterIP Services
+ {
+ Qname: "svc-dual-stack.testns.svc.cluster.local.", Qtype: dns.TypeA,
+ Rcode: dns.RcodeSuccess,
+ Answer: []dns.RR{
+ test.A("svc-dual-stack.testns.svc.cluster.local. 5 IN A 10.0.0.3"),
+ },
+ },
+ {
+ Qname: "svc-dual-stack.testns.svc.cluster.local.", Qtype: dns.TypeAAAA,
+ Rcode: dns.RcodeSuccess,
+ Answer: []dns.RR{
+ test.AAAA("svc-dual-stack.testns.svc.cluster.local. 5 IN AAAA 10::3"),
+ },
+ },
+ {
+ Qname: "svc-dual-stack.testns.svc.cluster.local.", Qtype: dns.TypeSRV,
+ Rcode: dns.RcodeSuccess,
+ Answer: []dns.RR{test.SRV("svc-dual-stack.testns.svc.cluster.local. 5 IN SRV 0 50 80 svc-dual-stack.testns.svc.cluster.local.")},
+ Extra: []dns.RR{
+ test.A("svc-dual-stack.testns.svc.cluster.local. 5 IN A 10.0.0.3"),
+ test.AAAA("svc-dual-stack.testns.svc.cluster.local. 5 IN AAAA 10::3"),
+ },
+ },
}
func TestServeDNS(t *testing.T) {
@@ -539,10 +563,10 @@ func (APIConnServeTest) PodIndex(ip string) []*object.Pod {
var svcIndex = map[string][]*object.Service{
"svc1.testns": {
{
- Name: "svc1",
- Namespace: "testns",
- Type: api.ServiceTypeClusterIP,
- ClusterIP: "10.0.0.1",
+ Name: "svc1",
+ Namespace: "testns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{"10.0.0.1"},
Ports: []api.ServicePort{
{Name: "http", Protocol: "tcp", Port: 80},
},
@@ -550,10 +574,10 @@ var svcIndex = map[string][]*object.Service{
},
"svcempty.testns": {
{
- Name: "svcempty",
- Namespace: "testns",
- Type: api.ServiceTypeClusterIP,
- ClusterIP: "10.0.0.1",
+ Name: "svcempty",
+ Namespace: "testns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{"10.0.0.1"},
Ports: []api.ServicePort{
{Name: "http", Protocol: "tcp", Port: 80},
},
@@ -561,10 +585,10 @@ var svcIndex = map[string][]*object.Service{
},
"svc6.testns": {
{
- Name: "svc6",
- Namespace: "testns",
- Type: api.ServiceTypeClusterIP,
- ClusterIP: "1234:abcd::1",
+ Name: "svc6",
+ Namespace: "testns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{"1234:abcd::1"},
Ports: []api.ServicePort{
{Name: "http", Protocol: "tcp", Port: 80},
},
@@ -572,10 +596,10 @@ var svcIndex = map[string][]*object.Service{
},
"hdls1.testns": {
{
- Name: "hdls1",
- Namespace: "testns",
- Type: api.ServiceTypeClusterIP,
- ClusterIP: api.ClusterIPNone,
+ Name: "hdls1",
+ Namespace: "testns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{api.ClusterIPNone},
},
},
"external.testns": {
@@ -602,23 +626,33 @@ var svcIndex = map[string][]*object.Service{
},
"hdlsprtls.testns": {
{
- Name: "hdlsprtls",
- Namespace: "testns",
- Type: api.ServiceTypeClusterIP,
- ClusterIP: api.ClusterIPNone,
+ Name: "hdlsprtls",
+ Namespace: "testns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{api.ClusterIPNone},
},
},
"svc1.unexposedns": {
{
- Name: "svc1",
- Namespace: "unexposedns",
- Type: api.ServiceTypeClusterIP,
- ClusterIP: "10.0.0.2",
+ Name: "svc1",
+ Namespace: "unexposedns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{"10.0.0.2"},
Ports: []api.ServicePort{
{Name: "http", Protocol: "tcp", Port: 80},
},
},
},
+ "svc-dual-stack.testns": {
+ {
+ Name: "svc-dual-stack",
+ Namespace: "testns",
+ Type: api.ServiceTypeClusterIP,
+ ClusterIPs: []string{"10.0.0.3", "10::3"}, Ports: []api.ServicePort{
+ {Name: "http", Protocol: "tcp", Port: 80},
+ },
+ },
+ },
}
func (APIConnServeTest) SvcIndex(s string) []*object.Service { return svcIndex[s] }