From 3418ceaca64208e57e1f07940af1fa31b85188c0 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Tue, 14 Mar 2023 16:17:48 +0100 Subject: [PATCH] test: replace intstr.FromInt with intstr.FromInt32 This touches cases where FromInt() is used on numeric constants, or values which are already int32s, or int variables which are defined close by and can be changed to int32s with little impact. Signed-off-by: Stephen Kitt --- test/e2e/apimachinery/aggregator.go | 4 +- .../apimachinery/crd_conversion_webhook.go | 4 +- test/e2e/apimachinery/generated_clientset.go | 2 +- test/e2e/apimachinery/namespace.go | 2 +- test/e2e/apimachinery/resource_quota.go | 2 +- test/e2e/apimachinery/webhook.go | 4 +- test/e2e/apps/daemon_set.go | 2 +- test/e2e/apps/disruption.go | 22 +++++----- test/e2e/common/node/container_probe.go | 4 +- test/e2e/common/node/lifecycle_hook.go | 8 ++-- test/e2e/common/node/pods.go | 2 +- test/e2e/framework/service/jig.go | 4 +- test/e2e/network/conntrack.go | 6 +-- test/e2e/network/endpointslice.go | 4 +- test/e2e/network/fixture.go | 2 +- test/e2e/network/funny_ips.go | 2 +- test/e2e/network/loadbalancer.go | 6 +-- test/e2e/network/proxy.go | 10 ++--- test/e2e/network/scale/ingress.go | 4 +- test/e2e/network/service.go | 42 +++++++++---------- test/e2e/network/topology_hints.go | 4 +- test/e2e/scheduling/ubernetes_lite.go | 2 +- test/e2e/storage/empty_dir_wrapper.go | 4 +- test/integration/daemonset/daemonset_test.go | 6 +-- .../integration/disruption/disruption_test.go | 4 +- test/integration/dualstack/dualstack_test.go | 14 +++---- test/integration/endpoints/endpoints_test.go | 6 +-- .../endpointsliceterminating_test.go | 2 +- test/integration/network/services_test.go | 2 +- test/integration/quota/quota_test.go | 2 +- .../scheduler/scoring/priorities_test.go | 2 +- test/soak/serve_hostnames/serve_hostnames.go | 2 +- 32 files changed, 93 insertions(+), 93 deletions(-) diff --git a/test/e2e/apimachinery/aggregator.go b/test/e2e/apimachinery/aggregator.go index 6c36d81b6d0..5f641815906 100644 --- a/test/e2e/apimachinery/aggregator.go +++ b/test/e2e/apimachinery/aggregator.go @@ -251,7 +251,7 @@ func SetUpSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclien ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ Scheme: v1.URISchemeHTTPS, - Port: intstr.FromInt(443), + Port: intstr.FromInt32(443), Path: "/readyz", }, }, @@ -300,7 +300,7 @@ func SetUpSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclien { Protocol: v1.ProtocolTCP, Port: aggregatorServicePort, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, diff --git a/test/e2e/apimachinery/crd_conversion_webhook.go b/test/e2e/apimachinery/crd_conversion_webhook.go index 641760ef971..4fd8a05826f 100644 --- a/test/e2e/apimachinery/crd_conversion_webhook.go +++ b/test/e2e/apimachinery/crd_conversion_webhook.go @@ -291,7 +291,7 @@ func deployCustomResourceWebhookAndService(ctx context.Context, f *framework.Fra ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ Scheme: v1.URISchemeHTTPS, - Port: intstr.FromInt(int(containerPort)), + Port: intstr.FromInt32(containerPort), Path: "/readyz", }, }, @@ -333,7 +333,7 @@ func deployCustomResourceWebhookAndService(ctx context.Context, f *framework.Fra { Protocol: v1.ProtocolTCP, Port: servicePort, - TargetPort: intstr.FromInt(int(containerPort)), + TargetPort: intstr.FromInt32(containerPort), }, }, }, diff --git a/test/e2e/apimachinery/generated_clientset.go b/test/e2e/apimachinery/generated_clientset.go index 113a5bba3ad..0951a94645a 100644 --- a/test/e2e/apimachinery/generated_clientset.go +++ b/test/e2e/apimachinery/generated_clientset.go @@ -56,7 +56,7 @@ func testingPod(name, value string) v1.Pod { ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ Path: "/index.html", - Port: intstr.FromInt(8080), + Port: intstr.FromInt32(8080), }, }, InitialDelaySeconds: 30, diff --git a/test/e2e/apimachinery/namespace.go b/test/e2e/apimachinery/namespace.go index 0d0fb9e71fa..8110fad48f5 100644 --- a/test/e2e/apimachinery/namespace.go +++ b/test/e2e/apimachinery/namespace.go @@ -170,7 +170,7 @@ func ensureServicesAreRemovedWhenNamespaceIsDeleted(ctx context.Context, f *fram Selector: labels, Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, }, } diff --git a/test/e2e/apimachinery/resource_quota.go b/test/e2e/apimachinery/resource_quota.go index f693a807b66..00e299a6cea 100644 --- a/test/e2e/apimachinery/resource_quota.go +++ b/test/e2e/apimachinery/resource_quota.go @@ -2058,7 +2058,7 @@ func newTestServiceForQuota(name string, serviceType v1.ServiceType, allocateLoa Type: serviceType, Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, AllocateLoadBalancerNodePorts: allocateNPs, }, diff --git a/test/e2e/apimachinery/webhook.go b/test/e2e/apimachinery/webhook.go index f8cc7c12069..e211f624eb2 100644 --- a/test/e2e/apimachinery/webhook.go +++ b/test/e2e/apimachinery/webhook.go @@ -790,7 +790,7 @@ func deployWebhookAndService(ctx context.Context, f *framework.Framework, image ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ Scheme: v1.URISchemeHTTPS, - Port: intstr.FromInt(int(containerPort)), + Port: intstr.FromInt32(containerPort), Path: "/readyz", }, }, @@ -829,7 +829,7 @@ func deployWebhookAndService(ctx context.Context, f *framework.Framework, image { Protocol: v1.ProtocolTCP, Port: servicePort, - TargetPort: intstr.FromInt(int(containerPort)), + TargetPort: intstr.FromInt32(containerPort), }, }, }, diff --git a/test/e2e/apps/daemon_set.go b/test/e2e/apps/daemon_set.go index d55e991277a..0c5a5241a54 100644 --- a/test/e2e/apps/daemon_set.go +++ b/test/e2e/apps/daemon_set.go @@ -510,7 +510,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() { maxSurgeOverlap := 60 * time.Second maxSurge := 1 surgePercent := intstr.FromString("20%") - zero := intstr.FromInt(0) + zero := intstr.FromInt32(0) oldVersion := "1" ds := newDaemonSet(dsName, image, label) ds.Spec.Template.Spec.Containers[0].Env = []v1.EnvVar{ diff --git a/test/e2e/apps/disruption.go b/test/e2e/apps/disruption.go index 444e45cd752..5dceaeb4316 100644 --- a/test/e2e/apps/disruption.go +++ b/test/e2e/apps/disruption.go @@ -87,9 +87,9 @@ var _ = SIGDescribe("DisruptionController", func() { framework.ConformanceIt("should list and delete a collection of PodDisruptionBudgets", func(ctx context.Context) { specialLabels := map[string]string{"foo_pdb": "bar_pdb"} labelSelector := labels.SelectorFromSet(specialLabels).String() - createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt(2), specialLabels) + createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt32(2), specialLabels) createPDBMinAvailableOrDie(ctx, cs, ns, "foo2", intstr.FromString("1%"), specialLabels) - createPDBMinAvailableOrDie(ctx, anotherFramework.ClientSet, anotherFramework.Namespace.Name, "foo3", intstr.FromInt(2), specialLabels) + createPDBMinAvailableOrDie(ctx, anotherFramework.ClientSet, anotherFramework.Namespace.Name, "foo3", intstr.FromInt32(2), specialLabels) ginkgo.By("listing a collection of PDBs across all namespaces") listPDBs(ctx, cs, metav1.NamespaceAll, labelSelector, 3, []string{defaultName, "foo2", "foo3"}) @@ -139,7 +139,7 @@ var _ = SIGDescribe("DisruptionController", func() { how many disruptions are allowed. */ framework.ConformanceIt("should observe PodDisruptionBudget status updated", func(ctx context.Context) { - createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt(1), defaultLabels) + createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt32(1), defaultLabels) createPodsOrDie(ctx, cs, ns, 3) waitForPodsOrDie(ctx, cs, ns, 3) @@ -162,7 +162,7 @@ var _ = SIGDescribe("DisruptionController", func() { Description: PodDisruptionBudget API must support update and patch operations on status subresource. */ framework.ConformanceIt("should update/patch PodDisruptionBudget status", func(ctx context.Context) { - createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt(1), defaultLabels) + createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt32(1), defaultLabels) ginkgo.By("Updating PodDisruptionBudget status") // PDB status can be updated by both PDB controller and the status API. The test selects `DisruptedPods` field to show immediate update via API. @@ -194,7 +194,7 @@ var _ = SIGDescribe("DisruptionController", func() { // PDB shouldn't error out when there are unmanaged pods ginkgo.It("should observe that the PodDisruptionBudget status is not updated for unmanaged pods", func(ctx context.Context) { - createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt(1), defaultLabels) + createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt32(1), defaultLabels) createPodsOrDie(ctx, cs, ns, 3) waitForPodsOrDie(ctx, cs, ns, 3) @@ -228,13 +228,13 @@ var _ = SIGDescribe("DisruptionController", func() { shouldDeny: false, }, { description: "too few pods, absolute", - minAvailable: intstr.FromInt(2), + minAvailable: intstr.FromInt32(2), maxUnavailable: intstr.FromString(""), podCount: 2, shouldDeny: true, }, { description: "enough pods, absolute", - minAvailable: intstr.FromInt(2), + minAvailable: intstr.FromInt32(2), maxUnavailable: intstr.FromString(""), podCount: 3, shouldDeny: false, @@ -266,7 +266,7 @@ var _ = SIGDescribe("DisruptionController", func() { { description: "maxUnavailable deny evictions, integer", minAvailable: intstr.FromString(""), - maxUnavailable: intstr.FromInt(1), + maxUnavailable: intstr.FromInt32(1), replicaSetSize: 10, exclusive: true, shouldDeny: true, @@ -348,7 +348,7 @@ var _ = SIGDescribe("DisruptionController", func() { */ framework.ConformanceIt("should block an eviction until the PDB is updated to allow it", func(ctx context.Context) { ginkgo.By("Creating a pdb that targets all three pods in a test replica set") - createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt(3), defaultLabels) + createPDBMinAvailableOrDie(ctx, cs, ns, defaultName, intstr.FromInt32(3), defaultLabels) createReplicaSetOrDie(ctx, cs, ns, 3, false) ginkgo.By("First trying to evict a pod which shouldn't be evictable") @@ -370,7 +370,7 @@ var _ = SIGDescribe("DisruptionController", func() { ginkgo.By("Updating the pdb to allow a pod to be evicted") updatePDBOrDie(ctx, cs, ns, defaultName, func(pdb *policyv1.PodDisruptionBudget) *policyv1.PodDisruptionBudget { - newMinAvailable := intstr.FromInt(2) + newMinAvailable := intstr.FromInt32(2) pdb.Spec.MinAvailable = &newMinAvailable return pdb }, cs.PolicyV1().PodDisruptionBudgets(ns).Update) @@ -386,7 +386,7 @@ var _ = SIGDescribe("DisruptionController", func() { oldData, err := json.Marshal(old) framework.ExpectNoError(err, "failed to marshal JSON for old data") old.Spec.MinAvailable = nil - maxUnavailable := intstr.FromInt(0) + maxUnavailable := intstr.FromInt32(0) old.Spec.MaxUnavailable = &maxUnavailable newData, err := json.Marshal(old) framework.ExpectNoError(err, "failed to marshal JSON for new data") diff --git a/test/e2e/common/node/container_probe.go b/test/e2e/common/node/container_probe.go index d0e443d7091..1bb41432e2a 100644 --- a/test/e2e/common/node/container_probe.go +++ b/test/e2e/common/node/container_probe.go @@ -470,7 +470,7 @@ var _ = SIGDescribe("Probing container", func() { ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ Path: "/healthz", - Port: intstr.FromInt(8080), + Port: intstr.FromInt32(8080), }, }, InitialDelaySeconds: 10, @@ -936,7 +936,7 @@ func (b webserverProbeBuilder) build() *v1.Probe { probe.InitialDelaySeconds = probeTestInitialDelaySeconds } if b.failing { - probe.HTTPGet.Port = intstr.FromInt(81) + probe.HTTPGet.Port = intstr.FromInt32(81) } return probe } diff --git a/test/e2e/common/node/lifecycle_hook.go b/test/e2e/common/node/lifecycle_hook.go index 57774417066..40ebed8c1dd 100644 --- a/test/e2e/common/node/lifecycle_hook.go +++ b/test/e2e/common/node/lifecycle_hook.go @@ -171,7 +171,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() { HTTPGet: &v1.HTTPGetAction{ Path: "/echo?msg=poststart", Host: targetIP, - Port: intstr.FromInt(8080), + Port: intstr.FromInt32(8080), }, }, } @@ -194,7 +194,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() { Scheme: v1.URISchemeHTTPS, Path: "/echo?msg=poststart", Host: targetIP, - Port: intstr.FromInt(9090), + Port: intstr.FromInt32(9090), }, }, } @@ -216,7 +216,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() { HTTPGet: &v1.HTTPGetAction{ Path: "/echo?msg=prestop", Host: targetIP, - Port: intstr.FromInt(8080), + Port: intstr.FromInt32(8080), }, }, } @@ -239,7 +239,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() { Scheme: v1.URISchemeHTTPS, Path: "/echo?msg=prestop", Host: targetIP, - Port: intstr.FromInt(9090), + Port: intstr.FromInt32(9090), }, }, } diff --git a/test/e2e/common/node/pods.go b/test/e2e/common/node/pods.go index f8ac287da5c..b71fc0d9015 100644 --- a/test/e2e/common/node/pods.go +++ b/test/e2e/common/node/pods.go @@ -481,7 +481,7 @@ var _ = SIGDescribe("Pods", func() { Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Port: 8765, - TargetPort: intstr.FromInt(8080), + TargetPort: intstr.FromInt32(8080), }}, Selector: map[string]string{ "name": serverName, diff --git a/test/e2e/framework/service/jig.go b/test/e2e/framework/service/jig.go index 0a45790ddd8..27c2db54ffa 100644 --- a/test/e2e/framework/service/jig.go +++ b/test/e2e/framework/service/jig.go @@ -663,7 +663,7 @@ func (j *TestJig) newRCTemplate() *v1.ReplicationController { PeriodSeconds: 3, ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ - Port: intstr.FromInt(80), + Port: intstr.FromInt32(80), Path: "/hostName", }, }, @@ -716,7 +716,7 @@ func (j *TestJig) CreatePDB(ctx context.Context, rc *v1.ReplicationController) ( // this j, but does not actually create the PDB. The default PDB specifies a // MinAvailable of N-1 and matches the pods created by the RC. func (j *TestJig) newPDBTemplate(rc *v1.ReplicationController) *policyv1.PodDisruptionBudget { - minAvailable := intstr.FromInt(int(*rc.Spec.Replicas) - 1) + minAvailable := intstr.FromInt32(*rc.Spec.Replicas - 1) pdb := &policyv1.PodDisruptionBudget{ ObjectMeta: metav1.ObjectMeta{ diff --git a/test/e2e/network/conntrack.go b/test/e2e/network/conntrack.go index b1961253057..866b1ea6afb 100644 --- a/test/e2e/network/conntrack.go +++ b/test/e2e/network/conntrack.go @@ -137,7 +137,7 @@ var _ = common.SIGDescribe("Conntrack", func() { udpService, err := udpJig.CreateUDPService(ctx, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt32(80)}, } }) framework.ExpectNoError(err) @@ -213,7 +213,7 @@ var _ = common.SIGDescribe("Conntrack", func() { udpService, err := udpJig.CreateUDPService(ctx, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeClusterIP svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt32(80)}, } }) framework.ExpectNoError(err) @@ -300,7 +300,7 @@ var _ = common.SIGDescribe("Conntrack", func() { udpService, err := udpJig.CreateUDPService(ctx, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeClusterIP svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt32(80)}, } }) framework.ExpectNoError(err) diff --git a/test/e2e/network/endpointslice.go b/test/e2e/network/endpointslice.go index 74fd48aa374..d755183aac6 100644 --- a/test/e2e/network/endpointslice.go +++ b/test/e2e/network/endpointslice.go @@ -268,7 +268,7 @@ var _ = common.SIGDescribe("EndpointSlice", func() { Ports: []v1.ServicePort{{ Name: "example", Port: 80, - TargetPort: intstr.FromInt(3000), + TargetPort: intstr.FromInt32(3000), Protocol: v1.ProtocolTCP, }}, }, @@ -300,7 +300,7 @@ var _ = common.SIGDescribe("EndpointSlice", func() { Ports: []v1.ServicePort{{ Name: "example-no-match", Port: 80, - TargetPort: intstr.FromInt(8080), + TargetPort: intstr.FromInt32(8080), Protocol: v1.ProtocolTCP, }}, }, diff --git a/test/e2e/network/fixture.go b/test/e2e/network/fixture.go index 9dfa2b88fba..8ff7794c32c 100644 --- a/test/e2e/network/fixture.go +++ b/test/e2e/network/fixture.go @@ -77,7 +77,7 @@ func (t *TestFixture) BuildServiceSpec() *v1.Service { Selector: t.Labels, Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, }, } diff --git a/test/e2e/network/funny_ips.go b/test/e2e/network/funny_ips.go index 8ed032edca2..a3ae1790f3a 100644 --- a/test/e2e/network/funny_ips.go +++ b/test/e2e/network/funny_ips.go @@ -106,7 +106,7 @@ var _ = common.SIGDescribe("CVE-2021-29923", func() { svc.Spec.ClusterIP = clusterIPZero // IP with a leading zero svc.Spec.Type = v1.ServiceTypeClusterIP svc.Spec.Ports = []v1.ServicePort{ - {Port: int32(servicePort), Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)}, + {Port: int32(servicePort), Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(9376)}, } }) framework.ExpectNoError(err) diff --git a/test/e2e/network/loadbalancer.go b/test/e2e/network/loadbalancer.go index dc4ea3cba73..7d2d50575ef 100644 --- a/test/e2e/network/loadbalancer.go +++ b/test/e2e/network/loadbalancer.go @@ -1037,7 +1037,7 @@ var _ = common.SIGDescribe("LoadBalancers", func() { _, err = udpJig.CreateUDPService(ctx, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeLoadBalancer svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt32(80)}, } }) framework.ExpectNoError(err) @@ -1169,7 +1169,7 @@ var _ = common.SIGDescribe("LoadBalancers", func() { _, err = udpJig.CreateUDPService(ctx, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeLoadBalancer svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt32(80)}, } }) framework.ExpectNoError(err) @@ -1425,7 +1425,7 @@ var _ = common.SIGDescribe("LoadBalancers ESIPP [Slow]", func() { // Change service port to avoid collision with opened hostPorts // in other tests that run in parallel. if len(svc.Spec.Ports) != 0 { - svc.Spec.Ports[0].TargetPort = intstr.FromInt(int(svc.Spec.Ports[0].Port)) + svc.Spec.Ports[0].TargetPort = intstr.FromInt32(svc.Spec.Ports[0].Port) svc.Spec.Ports[0].Port = 8081 } diff --git a/test/e2e/network/proxy.go b/test/e2e/network/proxy.go index eddac45c71d..efa5bf97c79 100644 --- a/test/e2e/network/proxy.go +++ b/test/e2e/network/proxy.go @@ -116,7 +116,7 @@ var _ = common.SIGDescribe("Proxy", func() { { Name: "portname2", Port: 81, - TargetPort: intstr.FromInt(162), + TargetPort: intstr.FromInt32(162), }, { Name: "tlsportname1", @@ -126,7 +126,7 @@ var _ = common.SIGDescribe("Proxy", func() { { Name: "tlsportname2", Port: 444, - TargetPort: intstr.FromInt(462), + TargetPort: intstr.FromInt32(462), }, }, }, @@ -166,7 +166,7 @@ var _ = common.SIGDescribe("Proxy", func() { ReadinessProbe: &v1.Probe{ ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ - Port: intstr.FromInt(80), + Port: intstr.FromInt32(80), }, }, InitialDelaySeconds: 1, @@ -324,7 +324,7 @@ var _ = common.SIGDescribe("Proxy", func() { Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), Protocol: v1.ProtocolTCP, }}, Selector: map[string]string{ @@ -418,7 +418,7 @@ var _ = common.SIGDescribe("Proxy", func() { Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), Protocol: v1.ProtocolTCP, }}, Selector: map[string]string{ diff --git a/test/e2e/network/scale/ingress.go b/test/e2e/network/scale/ingress.go index 8bbb730a2e2..1a6077854da 100644 --- a/test/e2e/network/scale/ingress.go +++ b/test/e2e/network/scale/ingress.go @@ -437,7 +437,7 @@ func generateScaleTestServiceSpec(suffix string) *v1.Service { Name: "http", Protocol: v1.ProtocolTCP, Port: 80, - TargetPort: intstr.FromInt(8080), + TargetPort: intstr.FromInt32(8080), }}, Selector: scaleTestLabels, Type: v1.ServiceTypeNodePort, @@ -458,7 +458,7 @@ func generateScaleTestBackendDeploymentSpec(numReplicas int32) *appsv1.Deploymen d.Spec.Template.Spec.Containers[0].ReadinessProbe = &v1.Probe{ ProbeHandler: v1.ProbeHandler{ HTTPGet: &v1.HTTPGetAction{ - Port: intstr.FromInt(8080), + Port: intstr.FromInt32(8080), Path: "/healthz", }, }, diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index afe86d7005f..758b08bbfe0 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -108,7 +108,7 @@ var ( Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Port: int32(defaultServeHostnameServicePort), - TargetPort: intstr.FromInt(9376), + TargetPort: intstr.FromInt32(9376), Protocol: v1.ProtocolTCP, }}, Selector: map[string]string{ @@ -1287,7 +1287,7 @@ var _ = common.SIGDescribe("Services", func() { nodePortService, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(9376)}, } }) framework.ExpectNoError(err) @@ -1319,7 +1319,7 @@ var _ = common.SIGDescribe("Services", func() { svc.Spec.Type = v1.ServiceTypeClusterIP svc.Spec.ExternalIPs = []string{externalIP} svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(9376)}, } }) if err != nil && strings.Contains(err.Error(), "Use of external IPs is denied by admission control") { @@ -1364,7 +1364,7 @@ var _ = common.SIGDescribe("Services", func() { Name: "tcp-port", Port: 80, Protocol: v1.ProtocolTCP, - TargetPort: intstr.FromInt(9376), + TargetPort: intstr.FromInt32(9376), }, } }) @@ -1384,13 +1384,13 @@ var _ = common.SIGDescribe("Services", func() { Name: "tcp-port", Port: 80, Protocol: v1.ProtocolTCP, - TargetPort: intstr.FromInt(9376), + TargetPort: intstr.FromInt32(9376), }, { Name: "udp-port", Port: 80, Protocol: v1.ProtocolUDP, - TargetPort: intstr.FromInt(9376), + TargetPort: intstr.FromInt32(9376), }, } }) @@ -1432,7 +1432,7 @@ var _ = common.SIGDescribe("Services", func() { s.Spec.Type = v1.ServiceTypeClusterIP s.Spec.ExternalName = "" s.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(9376)}, } }) framework.ExpectNoError(err) @@ -1471,7 +1471,7 @@ var _ = common.SIGDescribe("Services", func() { s.Spec.Type = v1.ServiceTypeNodePort s.Spec.ExternalName = "" s.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(9376)}, } }) framework.ExpectNoError(err) @@ -1764,7 +1764,7 @@ var _ = common.SIGDescribe("Services", func() { t.Name = "slow-terminating-unready-pod" t.Image = imageutils.GetE2EImage(imageutils.Agnhost) - port := 80 + port := int32(80) terminateSeconds := int64(100) service := &v1.Service{ @@ -1776,8 +1776,8 @@ var _ = common.SIGDescribe("Services", func() { Selector: t.Labels, Ports: []v1.ServicePort{{ Name: "http", - Port: int32(port), - TargetPort: intstr.FromInt(port), + Port: port, + TargetPort: intstr.FromInt32(port), }}, PublishNotReadyAddresses: true, }, @@ -1913,7 +1913,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.PublishNotReadyAddresses = true @@ -2032,7 +2032,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.PublishNotReadyAddresses = false @@ -2488,7 +2488,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.InternalTrafficPolicy = &local }) @@ -2556,7 +2556,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 8000, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(8000)}, + {Port: 8000, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(8000)}, } svc.Spec.InternalTrafficPolicy = &local }) @@ -2725,7 +2725,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.Type = v1.ServiceTypeLoadBalancer svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyLocal @@ -2819,7 +2819,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } }) framework.ExpectNoError(err) @@ -2893,7 +2893,7 @@ var _ = common.SIGDescribe("Services", func() { local := v1.ServiceInternalTrafficPolicyLocal svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.InternalTrafficPolicy = &local }) @@ -2970,7 +2970,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.Type = v1.ServiceTypeNodePort }) @@ -3045,7 +3045,7 @@ var _ = common.SIGDescribe("Services", func() { jig := e2eservice.NewTestJig(cs, ns, serviceName) svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) { svc.Spec.Ports = []v1.ServicePort{ - {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(80)}, + {Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt32(80)}, } svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyLocal @@ -3355,7 +3355,7 @@ var _ = common.SIGDescribe("Services", func() { Name: "http", Protocol: v1.ProtocolTCP, Port: int32(80), - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, }, } diff --git a/test/e2e/network/topology_hints.go b/test/e2e/network/topology_hints.go index 1eb3d6e1872..25c702b776d 100644 --- a/test/e2e/network/topology_hints.go +++ b/test/e2e/network/topology_hints.go @@ -53,7 +53,7 @@ var _ = common.SIGDescribe("[Feature:Topology Hints]", func() { }) ginkgo.It("should distribute endpoints evenly", func(ctx context.Context) { - portNum := 9376 + portNum := int32(9376) thLabels := map[string]string{labelKey: clientLabelValue} img := imageutils.GetE2EImage(imageutils.Agnhost) ports := []v1.ContainerPort{{ContainerPort: int32(portNum)}} @@ -74,7 +74,7 @@ var _ = common.SIGDescribe("[Feature:Topology Hints]", func() { Ports: []v1.ServicePort{{ Name: "example", Port: 80, - TargetPort: intstr.FromInt(portNum), + TargetPort: intstr.FromInt32(portNum), Protocol: v1.ProtocolTCP, }}, }, diff --git a/test/e2e/scheduling/ubernetes_lite.go b/test/e2e/scheduling/ubernetes_lite.go index dd26cf25424..a61fba5c038 100644 --- a/test/e2e/scheduling/ubernetes_lite.go +++ b/test/e2e/scheduling/ubernetes_lite.go @@ -93,7 +93,7 @@ func SpreadServiceOrFail(ctx context.Context, f *framework.Framework, replicaCou }, Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, }, } diff --git a/test/e2e/storage/empty_dir_wrapper.go b/test/e2e/storage/empty_dir_wrapper.go index 7ff396c6970..c9355f6ed35 100644 --- a/test/e2e/storage/empty_dir_wrapper.go +++ b/test/e2e/storage/empty_dir_wrapper.go @@ -211,7 +211,7 @@ var _ = utils.SIGDescribe("EmptyDir wrapper volumes", func() { func createGitServer(ctx context.Context, f *framework.Framework) (gitURL string, gitRepo string, cleanup func()) { var err error gitServerPodName := "git-server-" + string(uuid.NewUUID()) - containerPort := 8000 + containerPort := int32(8000) labels := map[string]string{"name": gitServerPodName} @@ -232,7 +232,7 @@ func createGitServer(ctx context.Context, f *framework.Framework) (gitURL string { Name: "http-portal", Port: int32(httpPort), - TargetPort: intstr.FromInt(containerPort), + TargetPort: intstr.FromInt32(containerPort), }, }, }, diff --git a/test/integration/daemonset/daemonset_test.go b/test/integration/daemonset/daemonset_test.go index bfd2e43f010..14e8fe0c352 100644 --- a/test/integration/daemonset/daemonset_test.go +++ b/test/integration/daemonset/daemonset_test.go @@ -196,7 +196,7 @@ func cleanupDaemonSets(t *testing.T, cs clientset.Interface, ds *apps.DaemonSet) } func newRollbackStrategy() *apps.DaemonSetUpdateStrategy { - one := intstr.FromInt(1) + one := intstr.FromInt32(1) return &apps.DaemonSetUpdateStrategy{ Type: apps.RollingUpdateDaemonSetStrategyType, RollingUpdate: &apps.RollingUpdateDaemonSet{MaxUnavailable: &one}, @@ -762,7 +762,7 @@ func TestLaunchWithHashCollision(t *testing.T) { // Create new DaemonSet with RollingUpdate strategy orgDs := newDaemonSet("foo", ns.Name) - oneIntString := intstr.FromInt(1) + oneIntString := intstr.FromInt32(1) orgDs.Spec.UpdateStrategy = apps.DaemonSetUpdateStrategy{ Type: apps.RollingUpdateDaemonSetStrategyType, RollingUpdate: &apps.RollingUpdateDaemonSet{ @@ -867,7 +867,7 @@ func TestDSCUpdatesPodLabelAfterDedupCurHistories(t *testing.T) { // Create new DaemonSet with RollingUpdate strategy orgDs := newDaemonSet("foo", ns.Name) - oneIntString := intstr.FromInt(1) + oneIntString := intstr.FromInt32(1) orgDs.Spec.UpdateStrategy = apps.DaemonSetUpdateStrategy{ Type: apps.RollingUpdateDaemonSetStrategyType, RollingUpdate: &apps.RollingUpdateDaemonSet{ diff --git a/test/integration/disruption/disruption_test.go b/test/integration/disruption/disruption_test.go index 8d2b47b3c2d..786cfe618e2 100644 --- a/test/integration/disruption/disruption_test.go +++ b/test/integration/disruption/disruption_test.go @@ -251,7 +251,7 @@ func TestEmptySelector(t *testing.T) { go pdbc.Run(ctx) replicas := 4 - minAvailable := intstr.FromInt(2) + minAvailable := intstr.FromInt32(2) for j := 0; j < replicas; j++ { createPod(ctx, t, fmt.Sprintf("pod-%d", j), nsName, map[string]string{"app": "test-crd"}, @@ -366,7 +366,7 @@ func TestSelectorsForPodsWithoutLabels(t *testing.T) { informers.Start(ctx.Done()) go pdbc.Run(ctx) - minAvailable := intstr.FromInt(1) + minAvailable := intstr.FromInt32(1) // Create the PDB first and wait for it to settle. pdbName := "test-pdb" diff --git a/test/integration/dualstack/dualstack_test.go b/test/integration/dualstack/dualstack_test.go index e2752b1a72e..1885fc913cc 100644 --- a/test/integration/dualstack/dualstack_test.go +++ b/test/integration/dualstack/dualstack_test.go @@ -237,7 +237,7 @@ func TestCreateServiceSingleStackIPv4(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, @@ -722,7 +722,7 @@ func TestCreateServiceDualStackIPv4IPv6(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, @@ -953,7 +953,7 @@ func TestCreateServiceDualStackIPv6IPv4(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, @@ -1020,7 +1020,7 @@ func TestUpgradeDowngrade(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, @@ -1126,7 +1126,7 @@ func TestConvertToFromExternalName(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, @@ -1215,7 +1215,7 @@ func TestPreferDualStack(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, @@ -1288,7 +1288,7 @@ func TestServiceUpdate(t *testing.T) { Ports: []v1.ServicePort{ { Port: 443, - TargetPort: intstr.FromInt(443), + TargetPort: intstr.FromInt32(443), }, }, }, diff --git a/test/integration/endpoints/endpoints_test.go b/test/integration/endpoints/endpoints_test.go index e0f445279a3..061ef3b966b 100644 --- a/test/integration/endpoints/endpoints_test.go +++ b/test/integration/endpoints/endpoints_test.go @@ -362,7 +362,7 @@ func TestEndpointWithTerminatingPod(t *testing.T) { "foo": "bar", }, Ports: []v1.ServicePort{ - {Name: "port-443", Port: 443, Protocol: "TCP", TargetPort: intstr.FromInt(443)}, + {Name: "port-443", Port: 443, Protocol: "TCP", TargetPort: intstr.FromInt32(443)}, }, }, } @@ -448,8 +448,8 @@ func newService(namespace, name string) *v1.Service { Spec: v1.ServiceSpec{ Selector: labelMap(), Ports: []v1.ServicePort{ - {Name: "port-1338", Port: 1338, Protocol: "TCP", TargetPort: intstr.FromInt(1338)}, - {Name: "port-1337", Port: 1337, Protocol: "TCP", TargetPort: intstr.FromInt(1337)}, + {Name: "port-1338", Port: 1338, Protocol: "TCP", TargetPort: intstr.FromInt32(1338)}, + {Name: "port-1337", Port: 1337, Protocol: "TCP", TargetPort: intstr.FromInt32(1337)}, }, }, } diff --git a/test/integration/endpointslice/endpointsliceterminating_test.go b/test/integration/endpointslice/endpointsliceterminating_test.go index d03af12f541..8ba60b6d2e1 100644 --- a/test/integration/endpointslice/endpointsliceterminating_test.go +++ b/test/integration/endpointslice/endpointsliceterminating_test.go @@ -158,7 +158,7 @@ func TestEndpointSliceTerminating(t *testing.T) { "foo": "bar", }, Ports: []corev1.ServicePort{ - {Name: "port-443", Port: 443, Protocol: "TCP", TargetPort: intstr.FromInt(443)}, + {Name: "port-443", Port: 443, Protocol: "TCP", TargetPort: intstr.FromInt32(443)}, }, }, } diff --git a/test/integration/network/services_test.go b/test/integration/network/services_test.go index 294d640bbaa..f3dc63ddc6a 100644 --- a/test/integration/network/services_test.go +++ b/test/integration/network/services_test.go @@ -79,7 +79,7 @@ func TestServicesFinalizersRepairLoop(t *testing.T) { Ports: []v1.ServicePort{{ Port: 8443, NodePort: 30443, - TargetPort: intstr.FromInt(8443), + TargetPort: intstr.FromInt32(8443), Protocol: v1.ProtocolTCP, }}, Type: v1.ServiceTypeNodePort, diff --git a/test/integration/quota/quota_test.go b/test/integration/quota/quota_test.go index c5e7c55b06a..f98b0723a40 100644 --- a/test/integration/quota/quota_test.go +++ b/test/integration/quota/quota_test.go @@ -591,7 +591,7 @@ func newService(name string, svcType v1.ServiceType, allocateNodePort bool) *v1. AllocateLoadBalancerNodePorts: allocateNPs, Ports: []v1.ServicePort{{ Port: int32(80), - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, }, } diff --git a/test/integration/scheduler/scoring/priorities_test.go b/test/integration/scheduler/scoring/priorities_test.go index d50d4d19996..0ec45fc83cf 100644 --- a/test/integration/scheduler/scoring/priorities_test.go +++ b/test/integration/scheduler/scoring/priorities_test.go @@ -673,7 +673,7 @@ func TestDefaultPodTopologySpreadScoring(t *testing.T) { }, Ports: []v1.ServicePort{{ Port: 80, - TargetPort: intstr.FromInt(80), + TargetPort: intstr.FromInt32(80), }}, }, } diff --git a/test/soak/serve_hostnames/serve_hostnames.go b/test/soak/serve_hostnames/serve_hostnames.go index 008ed46d5da..2a8f26ed9a8 100644 --- a/test/soak/serve_hostnames/serve_hostnames.go +++ b/test/soak/serve_hostnames/serve_hostnames.go @@ -155,7 +155,7 @@ func main() { Ports: []v1.ServicePort{{ Protocol: "TCP", Port: 9376, - TargetPort: intstr.FromInt(9376), + TargetPort: intstr.FromInt32(9376), }}, Selector: map[string]string{ "name": "serve-hostname",