From fed9411d5d1229e6c3d11e91955bc90c45b6f263 Mon Sep 17 00:00:00 2001 From: hangaoshuai Date: Tue, 7 Aug 2018 12:09:19 +0800 Subject: [PATCH] use const v1.ProtocolTCP replace of string TCP --- test/e2e/framework/framework.go | 2 +- test/e2e/framework/service_util.go | 4 ++-- test/e2e/framework/statefulset_utils.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index c7fe040707d..e37eb156c2d 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -548,7 +548,7 @@ func (f *Framework) CreateServiceForSimpleApp(contPort, svcPort int, appName str return nil } else { return []v1.ServicePort{{ - Protocol: "TCP", + Protocol: v1.ProtocolTCP, Port: int32(svcPort), TargetPort: intstr.FromInt(contPort), }} diff --git a/test/e2e/framework/service_util.go b/test/e2e/framework/service_util.go index 012ce7630c4..94c7b4871eb 100644 --- a/test/e2e/framework/service_util.go +++ b/test/e2e/framework/service_util.go @@ -254,7 +254,7 @@ func (j *ServiceTestJig) CreateOnlyLocalNodePortService(namespace, serviceName s svc := j.CreateTCPServiceOrFail(namespace, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal - svc.Spec.Ports = []v1.ServicePort{{Protocol: "TCP", Port: 80}} + svc.Spec.Ports = []v1.ServicePort{{Protocol: v1.ProtocolTCP, Port: 80}} }) if createPod { @@ -1414,7 +1414,7 @@ func CreateServiceSpec(serviceName, externalName string, isHeadless bool, select headlessService.Spec.ExternalName = externalName } else { headlessService.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: "TCP"}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP}, } } if isHeadless { diff --git a/test/e2e/framework/statefulset_utils.go b/test/e2e/framework/statefulset_utils.go index 7855b60da71..b2690b24907 100644 --- a/test/e2e/framework/statefulset_utils.go +++ b/test/e2e/framework/statefulset_utils.go @@ -64,7 +64,7 @@ func CreateStatefulSetService(name string, labels map[string]string) *v1.Service }, } headlessService.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: "TCP"}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP}, } headlessService.Spec.ClusterIP = "None" return headlessService