api: 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>
This commit is contained in:
Stephen Kitt
2023-03-14 16:17:48 +01:00
committed by Stephen Kitt
parent f871d5fabe
commit 4911e9de4a
24 changed files with 164 additions and 164 deletions

View File

@@ -181,7 +181,7 @@ func Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.
if len(in.Service.Port.Name) > 0 {
out.ServicePort = intstr.FromString(in.Service.Port.Name)
} else {
out.ServicePort = intstr.FromInt(int(in.Service.Port.Number))
out.ServicePort = intstr.FromInt32(in.Service.Port.Number)
}
}
return nil

View File

@@ -39,7 +39,7 @@ func TestIngressBackendConversion(t *testing.T) {
external: v1beta1.IngressSpec{
Backend: &v1beta1.IngressBackend{
ServiceName: "test-backend",
ServicePort: intstr.FromInt(8080),
ServicePort: intstr.FromInt32(8080),
},
},
internal: networking.IngressSpec{

View File

@@ -55,12 +55,12 @@ func SetDefaults_DaemonSet(obj *extensionsv1beta1.DaemonSet) {
}
if updateStrategy.RollingUpdate.MaxUnavailable == nil {
// Set default MaxUnavailable as 1 by default.
maxUnavailable := intstr.FromInt(1)
maxUnavailable := intstr.FromInt32(1)
updateStrategy.RollingUpdate.MaxUnavailable = &maxUnavailable
}
if updateStrategy.RollingUpdate.MaxSurge == nil {
// Set default MaxSurge as 0 by default.
maxSurge := intstr.FromInt(0)
maxSurge := intstr.FromInt32(0)
updateStrategy.RollingUpdate.MaxSurge = &maxSurge
}
}
@@ -99,12 +99,12 @@ func SetDefaults_Deployment(obj *extensionsv1beta1.Deployment) {
}
if strategy.RollingUpdate.MaxUnavailable == nil {
// Set default MaxUnavailable as 1 by default.
maxUnavailable := intstr.FromInt(1)
maxUnavailable := intstr.FromInt32(1)
strategy.RollingUpdate.MaxUnavailable = &maxUnavailable
}
if strategy.RollingUpdate.MaxSurge == nil {
// Set default MaxSurge as 1 by default.
maxSurge := intstr.FromInt(1)
maxSurge := intstr.FromInt32(1)
strategy.RollingUpdate.MaxSurge = &maxSurge
}
}

View File

@@ -160,8 +160,8 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
}
func TestSetDefaultDeployment(t *testing.T) {
defaultIntOrString := intstr.FromInt(1)
differentIntOrString := intstr.FromInt(5)
defaultIntOrString := intstr.FromInt32(1)
differentIntOrString := intstr.FromInt32(5)
period := int64(v1.DefaultTerminationGracePeriodSeconds)
defaultTemplate := v1.PodTemplateSpec{
Spec: v1.PodSpec{