Merge pull request #79386 from khenidak/phase2-dualstack

Phase 2 dualstack

Kubernetes-commit: 550fb1bfc3c773febbb0811262fd7a8f7847bb20
This commit is contained in:
Kubernetes Publisher 2019-08-28 20:39:56 -07:00
commit 17121693e2
5 changed files with 63 additions and 14 deletions

6
Godeps/Godeps.json generated
View file

@ -548,7 +548,7 @@
},
{
"ImportPath": "k8s.io/api",
"Rev": "198695d0603e"
"Rev": "40d3837b7e3d"
},
{
"ImportPath": "k8s.io/apimachinery",
@ -560,7 +560,7 @@
},
{
"ImportPath": "k8s.io/client-go",
"Rev": "b4d94f01600c"
"Rev": "8248d0a0e61a"
},
{
"ImportPath": "k8s.io/code-generator",
@ -568,7 +568,7 @@
},
{
"ImportPath": "k8s.io/component-base",
"Rev": "2d9047953ece"
"Rev": "ac1d987bcbab"
},
{
"ImportPath": "k8s.io/gengo",

12
go.mod
View file

@ -35,11 +35,11 @@ require (
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
gopkg.in/yaml.v2 v2.2.2
gotest.tools v2.2.0+incompatible // indirect
k8s.io/api v0.0.0-20190828114745-198695d0603e
k8s.io/api v0.0.0-20190829034738-40d3837b7e3d
k8s.io/apimachinery v0.0.0-20190828114620-4147c925140e
k8s.io/cli-runtime v0.0.0-20190828120509-9a5048624be8
k8s.io/client-go v0.0.0-20190828114957-b4d94f01600c
k8s.io/component-base v0.0.0-20190828155512-2d9047953ece
k8s.io/client-go v0.0.0-20190828235140-8248d0a0e61a
k8s.io/component-base v0.0.0-20190829035035-ac1d987bcbab
k8s.io/klog v0.4.0
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
k8s.io/metrics v0.0.0-20190828120413-207193cd263a
@ -56,11 +56,11 @@ replace (
golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503
golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db
golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d
k8s.io/api => k8s.io/api v0.0.0-20190828114745-198695d0603e
k8s.io/api => k8s.io/api v0.0.0-20190829034738-40d3837b7e3d
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190828114620-4147c925140e
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190828120509-9a5048624be8
k8s.io/client-go => k8s.io/client-go v0.0.0-20190828114957-b4d94f01600c
k8s.io/client-go => k8s.io/client-go v0.0.0-20190828235140-8248d0a0e61a
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190828114452-79369ab2ae19
k8s.io/component-base => k8s.io/component-base v0.0.0-20190828155512-2d9047953ece
k8s.io/component-base => k8s.io/component-base v0.0.0-20190829035035-ac1d987bcbab
k8s.io/metrics => k8s.io/metrics v0.0.0-20190828120413-207193cd263a
)

6
go.sum
View file

@ -273,12 +273,12 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20190828114745-198695d0603e/go.mod h1:Ik8tfB+q7IZDY6j3l3XfCxTl8s2knJz66H5FNYIj4oI=
k8s.io/api v0.0.0-20190829034738-40d3837b7e3d/go.mod h1:Ik8tfB+q7IZDY6j3l3XfCxTl8s2knJz66H5FNYIj4oI=
k8s.io/apimachinery v0.0.0-20190828114620-4147c925140e/go.mod h1:OOC7vMsHyCzra5xu6r1bRXkXMH76iww9BeHOAAJof4U=
k8s.io/cli-runtime v0.0.0-20190828120509-9a5048624be8/go.mod h1:MHPTyiuwsje/STRmczOtmp/++9c9zUm/UZj3jBQuMMA=
k8s.io/client-go v0.0.0-20190828114957-b4d94f01600c/go.mod h1:hBtPj8YqpSm13ext0Z7Q6KIeMoHk1g15un8WUjWgj4g=
k8s.io/client-go v0.0.0-20190828235140-8248d0a0e61a/go.mod h1:P6tyglhf3epZgAuvfPuTrCjtREWjhdpB0DOmwEbwv/A=
k8s.io/code-generator v0.0.0-20190828114452-79369ab2ae19/go.mod h1:DcZnH9wu/rlc2W9W82F8WPyJRR2mJVZGNE1cA/Qn6zQ=
k8s.io/component-base v0.0.0-20190828155512-2d9047953ece/go.mod h1:XVxj06gJil7Lnr+Suzg3dtMQPsgE5RTrQ3pO4+3ez9E=
k8s.io/component-base v0.0.0-20190829035035-ac1d987bcbab/go.mod h1:/+hHhZ8jfT5kDPmcYuJs9yWNDf2zLeNH6h0NPXP3y5M=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=

View file

@ -2478,6 +2478,11 @@ func describeService(service *corev1.Service, endpoints *corev1.Endpoints, event
w.Write(LEVEL_0, "Selector:\t%s\n", labels.FormatLabels(service.Spec.Selector))
w.Write(LEVEL_0, "Type:\t%s\n", service.Spec.Type)
w.Write(LEVEL_0, "IP:\t%s\n", service.Spec.ClusterIP)
if service.Spec.IPFamily != nil {
w.Write(LEVEL_0, "IPFamily:\t%s\n", *(service.Spec.IPFamily))
}
if len(service.Spec.ExternalIPs) > 0 {
w.Write(LEVEL_0, "External IPs:\t%v\n", strings.Join(service.Spec.ExternalIPs, ","))
}

View file

@ -351,6 +351,8 @@ func getResourceList(cpu, memory string) corev1.ResourceList {
}
func TestDescribeService(t *testing.T) {
defaultServiceIPFamily := corev1.IPv4Protocol
testCases := []struct {
name string
service *corev1.Service
@ -364,7 +366,8 @@ func TestDescribeService(t *testing.T) {
Namespace: "foo",
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
Type: corev1.ServiceTypeLoadBalancer,
IPFamily: &defaultServiceIPFamily,
Ports: []corev1.ServicePort{{
Name: "port-tcp",
Port: 8080,
@ -402,7 +405,8 @@ func TestDescribeService(t *testing.T) {
Namespace: "foo",
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
Type: corev1.ServiceTypeLoadBalancer,
IPFamily: &defaultServiceIPFamily,
Ports: []corev1.ServicePort{{
Name: "port-tcp",
Port: 8080,
@ -432,6 +436,46 @@ func TestDescribeService(t *testing.T) {
"HealthCheck NodePort", "32222",
},
},
{
name: "test-ServiceIPFamily",
service: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "bar",
Namespace: "foo",
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
IPFamily: &defaultServiceIPFamily,
Ports: []corev1.ServicePort{{
Name: "port-tcp",
Port: 8080,
Protocol: corev1.ProtocolTCP,
TargetPort: intstr.FromString("targetPort"),
NodePort: 31111,
}},
Selector: map[string]string{"blah": "heh"},
ClusterIP: "1.2.3.4",
LoadBalancerIP: "5.6.7.8",
SessionAffinity: "None",
ExternalTrafficPolicy: "Local",
HealthCheckNodePort: 32222,
},
},
expect: []string{
"Name", "bar",
"Namespace", "foo",
"Selector", "blah=heh",
"Type", "LoadBalancer",
"IP", "1.2.3.4",
"IPFamily", "IPv4",
"Port", "port-tcp", "8080/TCP",
"TargetPort", "targetPort/TCP",
"NodePort", "port-tcp", "31111/TCP",
"Session Affinity", "None",
"External Traffic Policy", "Local",
"HealthCheck NodePort", "32222",
},
},
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {