Skip to content

Commit c4246a4

Browse files
Merge pull request #132413 from PatrickLaabs/132086
Replaced deprecated pointer pkg with new ptr pkg on src/apimachinery Kubernetes-commit: 65c12acf7d17bb5584ca086af33ef6d6be80fc24
2 parents 2c1c0a3 + 8300050 commit c4246a4

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

apimachinery/lease/controller_test.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"k8s.io/client-go/kubernetes/fake"
3737
clienttesting "k8s.io/client-go/testing"
3838
testingclock "k8s.io/utils/clock/testing"
39-
"k8s.io/utils/pointer"
4039
"k8s.io/utils/ptr"
4140

4241
"k8s.io/klog/v2"
@@ -73,8 +72,8 @@ func TestNewNodeLease(t *testing.T) {
7372
Namespace: corev1.NamespaceNodeLease,
7473
},
7574
Spec: coordinationv1.LeaseSpec{
76-
HolderIdentity: pointer.StringPtr(node.Name),
77-
LeaseDurationSeconds: pointer.Int32Ptr(10),
75+
HolderIdentity: ptr.To(node.Name),
76+
LeaseDurationSeconds: ptr.To[int32](10),
7877
RenewTime: &metav1.MicroTime{Time: fakeClock.Now()},
7978
},
8079
},
@@ -103,8 +102,8 @@ func TestNewNodeLease(t *testing.T) {
103102
},
104103
},
105104
Spec: coordinationv1.LeaseSpec{
106-
HolderIdentity: pointer.StringPtr(node.Name),
107-
LeaseDurationSeconds: pointer.Int32Ptr(10),
105+
HolderIdentity: ptr.To(node.Name),
106+
LeaseDurationSeconds: ptr.To[int32](10),
108107
RenewTime: &metav1.MicroTime{Time: fakeClock.Now()},
109108
},
110109
},
@@ -123,8 +122,8 @@ func TestNewNodeLease(t *testing.T) {
123122
Namespace: corev1.NamespaceNodeLease,
124123
},
125124
Spec: coordinationv1.LeaseSpec{
126-
HolderIdentity: pointer.StringPtr(node.Name),
127-
LeaseDurationSeconds: pointer.Int32Ptr(10),
125+
HolderIdentity: ptr.To(node.Name),
126+
LeaseDurationSeconds: ptr.To[int32](10),
128127
RenewTime: &metav1.MicroTime{Time: fakeClock.Now().Add(-10 * time.Second)},
129128
},
130129
},
@@ -142,8 +141,8 @@ func TestNewNodeLease(t *testing.T) {
142141
},
143142
},
144143
Spec: coordinationv1.LeaseSpec{
145-
HolderIdentity: pointer.StringPtr(node.Name),
146-
LeaseDurationSeconds: pointer.Int32Ptr(10),
144+
HolderIdentity: ptr.To(node.Name),
145+
LeaseDurationSeconds: ptr.To[int32](10),
147146
RenewTime: &metav1.MicroTime{Time: fakeClock.Now()},
148147
},
149148
},
@@ -170,8 +169,8 @@ func TestNewNodeLease(t *testing.T) {
170169
},
171170
},
172171
Spec: coordinationv1.LeaseSpec{
173-
HolderIdentity: pointer.StringPtr(node.Name),
174-
LeaseDurationSeconds: pointer.Int32Ptr(10),
172+
HolderIdentity: ptr.To(node.Name),
173+
LeaseDurationSeconds: ptr.To[int32](10),
175174
RenewTime: &metav1.MicroTime{Time: fakeClock.Now().Add(-10 * time.Second)},
176175
},
177176
},
@@ -189,8 +188,8 @@ func TestNewNodeLease(t *testing.T) {
189188
},
190189
},
191190
Spec: coordinationv1.LeaseSpec{
192-
HolderIdentity: pointer.StringPtr(node.Name),
193-
LeaseDurationSeconds: pointer.Int32Ptr(10),
191+
HolderIdentity: ptr.To(node.Name),
192+
LeaseDurationSeconds: ptr.To[int32](10),
194193
RenewTime: &metav1.MicroTime{Time: fakeClock.Now()},
195194
},
196195
},

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ godebug default=go1.24
99
require (
1010
github.com/google/go-cmp v0.7.0
1111
github.com/stretchr/testify v1.10.0
12-
k8s.io/api v0.0.0-20250625172519-b820fad6b1cc
13-
k8s.io/apimachinery v0.0.0-20250625172236-d6651abdfec8
14-
k8s.io/client-go v0.0.0-20250625172911-958288110116
12+
k8s.io/api v0.0.0-20250626212533-a8e4c192362f
13+
k8s.io/apimachinery v0.0.0-20250701170151-1880ea593e95
14+
k8s.io/client-go v0.0.0-20250630172937-5e8db78e0499
1515
k8s.io/klog/v2 v2.130.1
1616
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
1717
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
137137
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
138138
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
139139
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
140-
k8s.io/api v0.0.0-20250625172519-b820fad6b1cc h1:sWQaPAV1Sz67sayzJXCBxPybdF77ISLHq5VoMYFBii8=
141-
k8s.io/api v0.0.0-20250625172519-b820fad6b1cc/go.mod h1:LeP8EGRerQcaOFKs8aGWs2rBBrJi5ByIeqfuMPuxCPk=
142-
k8s.io/apimachinery v0.0.0-20250625172236-d6651abdfec8 h1:MsspBt/pf3hqgJCgzv8XGYLMuKtRIKq77uZ13QyJ/eU=
143-
k8s.io/apimachinery v0.0.0-20250625172236-d6651abdfec8/go.mod h1:8gnN3W0XUgFL9P1KdRepAJFA98YuYViPoaUkwNZ1q70=
144-
k8s.io/client-go v0.0.0-20250625172911-958288110116 h1:XSKq9Bbohb9kmuZhikSdxLQx02HaHg2xVlavGE64mnM=
145-
k8s.io/client-go v0.0.0-20250625172911-958288110116/go.mod h1:Jz4vyKgB0jnBepznNT5YHdWzDWToklF9cWFW/mFnIc8=
140+
k8s.io/api v0.0.0-20250626212533-a8e4c192362f h1:2YOP2vawF3nJH5bLqFqE7/FSCEvLx3DlRwzw8U9plho=
141+
k8s.io/api v0.0.0-20250626212533-a8e4c192362f/go.mod h1:LeP8EGRerQcaOFKs8aGWs2rBBrJi5ByIeqfuMPuxCPk=
142+
k8s.io/apimachinery v0.0.0-20250701170151-1880ea593e95 h1:UPuLxCQp0u8Do+7amT7ROdAGLYxnkf/ZhmUP+YXD5dI=
143+
k8s.io/apimachinery v0.0.0-20250701170151-1880ea593e95/go.mod h1:8gnN3W0XUgFL9P1KdRepAJFA98YuYViPoaUkwNZ1q70=
144+
k8s.io/client-go v0.0.0-20250630172937-5e8db78e0499 h1:H1ALazQeWf1yF0qhlkwsdEvMFgUorS4vAIaB5hxw/tA=
145+
k8s.io/client-go v0.0.0-20250630172937-5e8db78e0499/go.mod h1:S35/NV7N0qaT+n8zdnMvSHhv01b7Gh36CDzj/Ei/1G0=
146146
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
147147
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
148148
k8s.io/kube-openapi v0.0.0-20250610211856-8b98d1ed966a h1:ZV3Zr+/7s7aVbjNGICQt+ppKWsF1tehxggNfbM7XnG8=

0 commit comments

Comments
 (0)