Use ptr.To to retrieve intstr addresses
This uses the generic ptr.To in k8s.io/utils to replace functions and code constructs which only serve to return pointers to intstr values. Other uses of the deprecated pointer package are updated in modified files. Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
@@ -33,7 +33,7 @@ import (
|
||||
deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
testutil "k8s.io/kubernetes/test/utils"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestNewDeployment(t *testing.T) {
|
||||
@@ -695,8 +695,8 @@ func TestScaledRolloutDeployment(t *testing.T) {
|
||||
var err error
|
||||
replicas := int32(10)
|
||||
tester := &deploymentTester{t: t, c: c, deployment: newDeployment(name, ns.Name, replicas)}
|
||||
tester.deployment.Spec.Strategy.RollingUpdate.MaxSurge = intOrStrP(3)
|
||||
tester.deployment.Spec.Strategy.RollingUpdate.MaxUnavailable = intOrStrP(2)
|
||||
tester.deployment.Spec.Strategy.RollingUpdate.MaxSurge = ptr.To(intstr.FromInt32(3))
|
||||
tester.deployment.Spec.Strategy.RollingUpdate.MaxUnavailable = ptr.To(intstr.FromInt32(2))
|
||||
tester.deployment, err = c.AppsV1().Deployments(ns.Name).Create(context.TODO(), tester.deployment, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create deployment %q: %v", name, err)
|
||||
@@ -912,7 +912,7 @@ func TestSpecReplicasChange(t *testing.T) {
|
||||
var oldGeneration int64
|
||||
tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) {
|
||||
oldGeneration = update.Generation
|
||||
update.Spec.RevisionHistoryLimit = pointer.Int32(4)
|
||||
update.Spec.RevisionHistoryLimit = ptr.To[int32](4)
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("failed updating deployment %q: %v", tester.deployment.Name, err)
|
||||
@@ -945,7 +945,7 @@ func TestDeploymentAvailableCondition(t *testing.T) {
|
||||
// Assign a high value to the deployment's minReadySeconds
|
||||
tester.deployment.Spec.MinReadySeconds = 3600
|
||||
// progressDeadlineSeconds must be greater than minReadySeconds
|
||||
tester.deployment.Spec.ProgressDeadlineSeconds = pointer.Int32(7200)
|
||||
tester.deployment.Spec.ProgressDeadlineSeconds = ptr.To[int32](7200)
|
||||
var err error
|
||||
tester.deployment, err = c.AppsV1().Deployments(ns.Name).Create(context.TODO(), tester.deployment, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user