api-machinery: 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 <skitt@redhat.com>

Kubernetes-commit: 94410ee8078971b8894e5c400ce3fc79f02bc510
This commit is contained in:
Stephen Kitt 2023-03-14 16:17:48 +01:00 committed by Kubernetes Publisher
parent 2dff60bb4d
commit 6caa44cc84
1 changed files with 13 additions and 13 deletions

View File

@ -68,7 +68,7 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeClusterIP,
ClusterIP: "hit",
Ports: []v1.ServicePort{
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},
@ -87,8 +87,8 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeClusterIP,
ClusterIP: "hit",
Ports: []v1.ServicePort{
{Name: "https", Port: 443, TargetPort: intstr.FromInt(1443)},
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Name: "https", Port: 443, TargetPort: intstr.FromInt32(1443)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},
@ -107,8 +107,8 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeClusterIP,
ClusterIP: "hit",
Ports: []v1.ServicePort{
{Name: "https", Port: 443, TargetPort: intstr.FromInt(1443)},
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Name: "https", Port: 443, TargetPort: intstr.FromInt32(1443)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},
@ -127,8 +127,8 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeClusterIP,
ClusterIP: "hit",
Ports: []v1.ServicePort{
{Name: "https", Port: 443, TargetPort: intstr.FromInt(1443)},
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Name: "https", Port: 443, TargetPort: intstr.FromInt32(1443)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},
@ -152,8 +152,8 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeClusterIP,
ClusterIP: "hit",
Ports: []v1.ServicePort{
{Name: "https", Port: 443, TargetPort: intstr.FromInt(1443)},
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Name: "https", Port: 443, TargetPort: intstr.FromInt32(1443)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},
@ -196,8 +196,8 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeLoadBalancer,
ClusterIP: "lb",
Ports: []v1.ServicePort{
{Name: "https", Port: 443, TargetPort: intstr.FromInt(1443)},
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Name: "https", Port: 443, TargetPort: intstr.FromInt32(1443)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},
@ -216,8 +216,8 @@ func TestResolve(t *testing.T) {
Type: v1.ServiceTypeNodePort,
ClusterIP: "np",
Ports: []v1.ServicePort{
{Name: "https", Port: 443, TargetPort: intstr.FromInt(1443)},
{Port: 1234, TargetPort: intstr.FromInt(1234)},
{Name: "https", Port: 443, TargetPort: intstr.FromInt32(1443)},
{Port: 1234, TargetPort: intstr.FromInt32(1234)},
},
},
},