@@ -44,7 +44,7 @@ import (
44
44
"k8s.io/endpointslice/topologycache"
45
45
endpointsliceutil "k8s.io/endpointslice/util"
46
46
"k8s.io/klog/v2/ktesting"
47
- "k8s.io/utils/pointer "
47
+ "k8s.io/utils/ptr "
48
48
)
49
49
50
50
const (
@@ -189,12 +189,12 @@ func TestReconcile1Pod(t *testing.T) {
189
189
{
190
190
Addresses : []string {"1.2.3.4" },
191
191
Conditions : discovery.EndpointConditions {
192
- Ready : pointer . Bool (true ),
193
- Serving : pointer . Bool (true ),
194
- Terminating : pointer . Bool (false ),
192
+ Ready : ptr . To (true ),
193
+ Serving : ptr . To (true ),
194
+ Terminating : ptr . To (false ),
195
195
},
196
- Zone : pointer . String ("us-central1-a" ),
197
- NodeName : pointer . String ("node-1" ),
196
+ Zone : ptr . To ("us-central1-a" ),
197
+ NodeName : ptr . To ("node-1" ),
198
198
TargetRef : & corev1.ObjectReference {
199
199
Kind : "Pod" ,
200
200
Namespace : namespace ,
@@ -215,12 +215,12 @@ func TestReconcile1Pod(t *testing.T) {
215
215
{
216
216
Addresses : []string {"1.2.3.4" },
217
217
Conditions : discovery.EndpointConditions {
218
- Ready : pointer . Bool (true ),
219
- Serving : pointer . Bool (true ),
220
- Terminating : pointer . Bool (false ),
218
+ Ready : ptr . To (true ),
219
+ Serving : ptr . To (true ),
220
+ Terminating : ptr . To (false ),
221
221
},
222
- Zone : pointer . String ("us-central1-a" ),
223
- NodeName : pointer . String ("node-1" ),
222
+ Zone : ptr . To ("us-central1-a" ),
223
+ NodeName : ptr . To ("node-1" ),
224
224
TargetRef : & corev1.ObjectReference {
225
225
Kind : "Pod" ,
226
226
Namespace : namespace ,
@@ -242,12 +242,12 @@ func TestReconcile1Pod(t *testing.T) {
242
242
{
243
243
Addresses : []string {"1.2.3.4" },
244
244
Conditions : discovery.EndpointConditions {
245
- Ready : pointer . Bool (true ),
246
- Serving : pointer . Bool (true ),
247
- Terminating : pointer . Bool (false ),
245
+ Ready : ptr . To (true ),
246
+ Serving : ptr . To (true ),
247
+ Terminating : ptr . To (false ),
248
248
},
249
- Zone : pointer . String ("us-central1-a" ),
250
- NodeName : pointer . String ("node-1" ),
249
+ Zone : ptr . To ("us-central1-a" ),
250
+ NodeName : ptr . To ("node-1" ),
251
251
TargetRef : & corev1.ObjectReference {
252
252
Kind : "Pod" ,
253
253
Namespace : namespace ,
@@ -260,12 +260,12 @@ func TestReconcile1Pod(t *testing.T) {
260
260
expectedEndpoint : discovery.Endpoint {
261
261
Addresses : []string {"1.2.3.4" },
262
262
Conditions : discovery.EndpointConditions {
263
- Ready : pointer . Bool (true ),
264
- Serving : pointer . Bool (true ),
265
- Terminating : pointer . Bool (false ),
263
+ Ready : ptr . To (true ),
264
+ Serving : ptr . To (true ),
265
+ Terminating : ptr . To (false ),
266
266
},
267
- Zone : pointer . String ("us-central1-a" ),
268
- NodeName : pointer . String ("node-1" ),
267
+ Zone : ptr . To ("us-central1-a" ),
268
+ NodeName : ptr . To ("node-1" ),
269
269
TargetRef : & corev1.ObjectReference {
270
270
Kind : "Pod" ,
271
271
Namespace : namespace ,
@@ -284,12 +284,12 @@ func TestReconcile1Pod(t *testing.T) {
284
284
{
285
285
Addresses : []string {"1.2.3.4" },
286
286
Conditions : discovery.EndpointConditions {
287
- Ready : pointer . Bool (true ),
288
- Serving : pointer . Bool (true ),
289
- Terminating : pointer . Bool (false ),
287
+ Ready : ptr . To (true ),
288
+ Serving : ptr . To (true ),
289
+ Terminating : ptr . To (false ),
290
290
},
291
- Zone : pointer . String ("us-central1-a" ),
292
- NodeName : pointer . String ("node-1" ),
291
+ Zone : ptr . To ("us-central1-a" ),
292
+ NodeName : ptr . To ("node-1" ),
293
293
TargetRef : & corev1.ObjectReference {
294
294
Kind : "Pod" ,
295
295
Namespace : namespace ,
@@ -302,12 +302,12 @@ func TestReconcile1Pod(t *testing.T) {
302
302
expectedEndpoint : discovery.Endpoint {
303
303
Addresses : []string {"1.2.3.4" },
304
304
Conditions : discovery.EndpointConditions {
305
- Ready : pointer . Bool (true ),
306
- Serving : pointer . Bool (true ),
307
- Terminating : pointer . Bool (false ),
305
+ Ready : ptr . To (true ),
306
+ Serving : ptr . To (true ),
307
+ Terminating : ptr . To (false ),
308
308
},
309
- Zone : pointer . String ("us-central1-a" ),
310
- NodeName : pointer . String ("node-1" ),
309
+ Zone : ptr . To ("us-central1-a" ),
310
+ NodeName : ptr . To ("node-1" ),
311
311
TargetRef : & corev1.ObjectReference {
312
312
Kind : "Pod" ,
313
313
Namespace : namespace ,
@@ -328,12 +328,12 @@ func TestReconcile1Pod(t *testing.T) {
328
328
{
329
329
Addresses : []string {"1.2.3.4" },
330
330
Conditions : discovery.EndpointConditions {
331
- Ready : pointer . Bool (true ),
332
- Serving : pointer . Bool (true ),
333
- Terminating : pointer . Bool (false ),
331
+ Ready : ptr . To (true ),
332
+ Serving : ptr . To (true ),
333
+ Terminating : ptr . To (false ),
334
334
},
335
- Zone : pointer . String ("us-central1-a" ),
336
- NodeName : pointer . String ("node-1" ),
335
+ Zone : ptr . To ("us-central1-a" ),
336
+ NodeName : ptr . To ("node-1" ),
337
337
TargetRef : & corev1.ObjectReference {
338
338
Kind : "Pod" ,
339
339
Namespace : namespace ,
@@ -346,12 +346,12 @@ func TestReconcile1Pod(t *testing.T) {
346
346
expectedEndpoint : discovery.Endpoint {
347
347
Addresses : []string {"1.2.3.4" },
348
348
Conditions : discovery.EndpointConditions {
349
- Ready : pointer . Bool (true ),
350
- Serving : pointer . Bool (true ),
351
- Terminating : pointer . Bool (false ),
349
+ Ready : ptr . To (true ),
350
+ Serving : ptr . To (true ),
351
+ Terminating : ptr . To (false ),
352
352
},
353
- Zone : pointer . String ("us-central1-a" ),
354
- NodeName : pointer . String ("node-1" ),
353
+ Zone : ptr . To ("us-central1-a" ),
354
+ NodeName : ptr . To ("node-1" ),
355
355
TargetRef : & corev1.ObjectReference {
356
356
Kind : "Pod" ,
357
357
Namespace : namespace ,
@@ -372,12 +372,12 @@ func TestReconcile1Pod(t *testing.T) {
372
372
{
373
373
Addresses : []string {"1234::5678:0:0:9abc:def0" },
374
374
Conditions : discovery.EndpointConditions {
375
- Ready : pointer . Bool (true ),
376
- Serving : pointer . Bool (true ),
377
- Terminating : pointer . Bool (false ),
375
+ Ready : ptr . To (true ),
376
+ Serving : ptr . To (true ),
377
+ Terminating : ptr . To (false ),
378
378
},
379
- Zone : pointer . String ("us-central1-a" ),
380
- NodeName : pointer . String ("node-1" ),
379
+ Zone : ptr . To ("us-central1-a" ),
380
+ NodeName : ptr . To ("node-1" ),
381
381
TargetRef : & corev1.ObjectReference {
382
382
Kind : "Pod" ,
383
383
Namespace : namespace ,
@@ -400,12 +400,12 @@ func TestReconcile1Pod(t *testing.T) {
400
400
{
401
401
Addresses : []string {"1234::5678:0:0:9abc:def0" },
402
402
Conditions : discovery.EndpointConditions {
403
- Ready : pointer . Bool (true ),
404
- Serving : pointer . Bool (true ),
405
- Terminating : pointer . Bool (false ),
403
+ Ready : ptr . To (true ),
404
+ Serving : ptr . To (true ),
405
+ Terminating : ptr . To (false ),
406
406
},
407
- Zone : pointer . String ("us-central1-a" ),
408
- NodeName : pointer . String ("node-1" ),
407
+ Zone : ptr . To ("us-central1-a" ),
408
+ NodeName : ptr . To ("node-1" ),
409
409
TargetRef : & corev1.ObjectReference {
410
410
Kind : "Pod" ,
411
411
Namespace : namespace ,
@@ -427,12 +427,12 @@ func TestReconcile1Pod(t *testing.T) {
427
427
{
428
428
Addresses : []string {"1234::5678:0:0:9abc:def0" },
429
429
Conditions : discovery.EndpointConditions {
430
- Ready : pointer . Bool (true ),
431
- Serving : pointer . Bool (true ),
432
- Terminating : pointer . Bool (false ),
430
+ Ready : ptr . To (true ),
431
+ Serving : ptr . To (true ),
432
+ Terminating : ptr . To (false ),
433
433
},
434
- Zone : pointer . String ("us-central1-a" ),
435
- NodeName : pointer . String ("node-1" ),
434
+ Zone : ptr . To ("us-central1-a" ),
435
+ NodeName : ptr . To ("node-1" ),
436
436
TargetRef : & corev1.ObjectReference {
437
437
Kind : "Pod" ,
438
438
Namespace : namespace ,
@@ -444,12 +444,12 @@ func TestReconcile1Pod(t *testing.T) {
444
444
{
445
445
Addresses : []string {"1.2.3.4" },
446
446
Conditions : discovery.EndpointConditions {
447
- Ready : pointer . Bool (true ),
448
- Serving : pointer . Bool (true ),
449
- Terminating : pointer . Bool (false ),
447
+ Ready : ptr . To (true ),
448
+ Serving : ptr . To (true ),
449
+ Terminating : ptr . To (false ),
450
450
},
451
- Zone : pointer . String ("us-central1-a" ),
452
- NodeName : pointer . String ("node-1" ),
451
+ Zone : ptr . To ("us-central1-a" ),
452
+ NodeName : ptr . To ("node-1" ),
453
453
TargetRef : & corev1.ObjectReference {
454
454
Kind : "Pod" ,
455
455
Namespace : namespace ,
@@ -1252,14 +1252,13 @@ func TestReconcileEndpointSlicesNamedPorts(t *testing.T) {
1252
1252
expectUnorderedSlicesWithLengths (t , fetchedSlices , []int {60 , 60 , 60 , 60 , 60 })
1253
1253
1254
1254
// generate data structures for expected slice ports and address types
1255
- protoTCP := corev1 .ProtocolTCP
1256
1255
expectedSlices := []discovery.EndpointSlice {}
1257
1256
for i := range fetchedSlices {
1258
1257
expectedSlices = append (expectedSlices , discovery.EndpointSlice {
1259
1258
Ports : []discovery.EndpointPort {{
1260
- Name : pointer . String ("" ),
1261
- Protocol : & protoTCP ,
1262
- Port : pointer . Int32 (int32 (8080 + i )),
1259
+ Name : ptr . To ("" ),
1260
+ Protocol : ptr . To ( corev1 . ProtocolTCP ) ,
1261
+ Port : ptr. To [ int32 ] (int32 (8080 + i )),
1263
1262
}},
1264
1263
AddressType : discovery .AddressTypeIPv4 ,
1265
1264
})
0 commit comments