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>
This commit is contained in:
parent
302434e392
commit
51c05679e6
14 changed files with 204 additions and 111 deletions
|
@ -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] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue