@@ -31,7 +31,7 @@ import (
31
31
"k8s.io/klog/v2/ktesting"
32
32
"k8s.io/kubernetes/pkg/controller"
33
33
"k8s.io/kubernetes/pkg/features"
34
- "k8s.io/utils/pointer "
34
+ "k8s.io/utils/ptr "
35
35
)
36
36
37
37
const noIndex = "-"
@@ -209,7 +209,7 @@ func TestCalculateSucceededIndexes(t *testing.T) {
209
209
CompletedIndexes : tc .prevSucceeded ,
210
210
},
211
211
Spec : batch.JobSpec {
212
- Completions : pointer . Int32 (tc .completions ),
212
+ Completions : ptr . To (tc .completions ),
213
213
},
214
214
}
215
215
pods := hollowPodsWithIndexPhase (tc .pods )
@@ -238,8 +238,8 @@ func TestIsIndexFailed(t *testing.T) {
238
238
"failed pod exceeding backoffLimitPerIndex, when backoffLimitPerIndex=0" : {
239
239
job : batch.Job {
240
240
Spec : batch.JobSpec {
241
- Completions : pointer . Int32 (2 ),
242
- BackoffLimitPerIndex : pointer . Int32 (0 ),
241
+ Completions : ptr. To [ int32 ] (2 ),
242
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
243
243
},
244
244
},
245
245
pod : buildPod ().indexFailureCount ("0" ).phase (v1 .PodFailed ).index ("0" ).trackingFinalizer ().Pod ,
@@ -248,8 +248,8 @@ func TestIsIndexFailed(t *testing.T) {
248
248
"failed pod exceeding backoffLimitPerIndex, when backoffLimitPerIndex=1" : {
249
249
job : batch.Job {
250
250
Spec : batch.JobSpec {
251
- Completions : pointer . Int32 (2 ),
252
- BackoffLimitPerIndex : pointer . Int32 (1 ),
251
+ Completions : ptr. To [ int32 ] (2 ),
252
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
253
253
},
254
254
},
255
255
pod : buildPod ().indexFailureCount ("1" ).phase (v1 .PodFailed ).index ("1" ).trackingFinalizer ().Pod ,
@@ -259,8 +259,8 @@ func TestIsIndexFailed(t *testing.T) {
259
259
enableJobPodFailurePolicy : true ,
260
260
job : batch.Job {
261
261
Spec : batch.JobSpec {
262
- Completions : pointer . Int32 (2 ),
263
- BackoffLimitPerIndex : pointer . Int32 (1 ),
262
+ Completions : ptr. To [ int32 ] (2 ),
263
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
264
264
PodFailurePolicy : & batch.PodFailurePolicy {
265
265
Rules : []batch.PodFailurePolicyRule {
266
266
{
@@ -292,8 +292,8 @@ func TestIsIndexFailed(t *testing.T) {
292
292
enableJobPodFailurePolicy : false ,
293
293
job : batch.Job {
294
294
Spec : batch.JobSpec {
295
- Completions : pointer . Int32 (2 ),
296
- BackoffLimitPerIndex : pointer . Int32 (1 ),
295
+ Completions : ptr. To [ int32 ] (2 ),
296
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
297
297
PodFailurePolicy : & batch.PodFailurePolicy {
298
298
Rules : []batch.PodFailurePolicyRule {
299
299
{
@@ -346,8 +346,8 @@ func TestCalculateFailedIndexes(t *testing.T) {
346
346
"one new index failed" : {
347
347
job : batch.Job {
348
348
Spec : batch.JobSpec {
349
- Completions : pointer . Int32 (2 ),
350
- BackoffLimitPerIndex : pointer . Int32 (1 ),
349
+ Completions : ptr. To [ int32 ] (2 ),
350
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
351
351
},
352
352
},
353
353
pods : []* v1.Pod {
@@ -359,8 +359,8 @@ func TestCalculateFailedIndexes(t *testing.T) {
359
359
"pod without finalizer is ignored" : {
360
360
job : batch.Job {
361
361
Spec : batch.JobSpec {
362
- Completions : pointer . Int32 (2 ),
363
- BackoffLimitPerIndex : pointer . Int32 (0 ),
362
+ Completions : ptr. To [ int32 ] (2 ),
363
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
364
364
},
365
365
},
366
366
pods : []* v1.Pod {
@@ -371,8 +371,8 @@ func TestCalculateFailedIndexes(t *testing.T) {
371
371
"pod outside completions is ignored" : {
372
372
job : batch.Job {
373
373
Spec : batch.JobSpec {
374
- Completions : pointer . Int32 (2 ),
375
- BackoffLimitPerIndex : pointer . Int32 (0 ),
374
+ Completions : ptr. To [ int32 ] (2 ),
375
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
376
376
},
377
377
},
378
378
pods : []* v1.Pod {
@@ -383,11 +383,11 @@ func TestCalculateFailedIndexes(t *testing.T) {
383
383
"extend the failed indexes" : {
384
384
job : batch.Job {
385
385
Status : batch.JobStatus {
386
- FailedIndexes : pointer . String ("0" ),
386
+ FailedIndexes : ptr . To ("0" ),
387
387
},
388
388
Spec : batch.JobSpec {
389
- Completions : pointer . Int32 (2 ),
390
- BackoffLimitPerIndex : pointer . Int32 (0 ),
389
+ Completions : ptr. To [ int32 ] (2 ),
390
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
391
391
},
392
392
},
393
393
pods : []* v1.Pod {
@@ -398,11 +398,11 @@ func TestCalculateFailedIndexes(t *testing.T) {
398
398
"prev failed indexes empty" : {
399
399
job : batch.Job {
400
400
Status : batch.JobStatus {
401
- FailedIndexes : pointer . String ("" ),
401
+ FailedIndexes : ptr . To ("" ),
402
402
},
403
403
Spec : batch.JobSpec {
404
- Completions : pointer . Int32 (2 ),
405
- BackoffLimitPerIndex : pointer . Int32 (0 ),
404
+ Completions : ptr. To [ int32 ] (2 ),
405
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
406
406
},
407
407
},
408
408
pods : []* v1.Pod {
@@ -413,11 +413,11 @@ func TestCalculateFailedIndexes(t *testing.T) {
413
413
"prev failed indexes outside the completions" : {
414
414
job : batch.Job {
415
415
Status : batch.JobStatus {
416
- FailedIndexes : pointer . String ("9" ),
416
+ FailedIndexes : ptr . To ("9" ),
417
417
},
418
418
Spec : batch.JobSpec {
419
- Completions : pointer . Int32 (2 ),
420
- BackoffLimitPerIndex : pointer . Int32 (0 ),
419
+ Completions : ptr. To [ int32 ] (2 ),
420
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
421
421
},
422
422
},
423
423
pods : []* v1.Pod {
@@ -449,8 +449,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
449
449
"failed pods are kept corresponding to non-failed indexes are kept" : {
450
450
job : batch.Job {
451
451
Spec : batch.JobSpec {
452
- Completions : pointer . Int32 (3 ),
453
- BackoffLimitPerIndex : pointer . Int32 (1 ),
452
+ Completions : ptr. To [ int32 ] (3 ),
453
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
454
454
},
455
455
},
456
456
pods : []* v1.Pod {
@@ -463,8 +463,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
463
463
"failed pod without finalizer; the pod's deletion is not delayed as it already started" : {
464
464
job : batch.Job {
465
465
Spec : batch.JobSpec {
466
- Completions : pointer . Int32 (2 ),
467
- BackoffLimitPerIndex : pointer . Int32 (0 ),
466
+ Completions : ptr. To [ int32 ] (2 ),
467
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
468
468
},
469
469
},
470
470
pods : []* v1.Pod {
@@ -475,8 +475,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
475
475
"failed pod with expected finalizer removal; the pod's deletion is not delayed as it already started" : {
476
476
job : batch.Job {
477
477
Spec : batch.JobSpec {
478
- Completions : pointer . Int32 (2 ),
479
- BackoffLimitPerIndex : pointer . Int32 (0 ),
478
+ Completions : ptr. To [ int32 ] (2 ),
479
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
480
480
},
481
481
},
482
482
pods : []* v1.Pod {
@@ -488,8 +488,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
488
488
"failed pod with index outside of completions; the pod's deletion is not delayed" : {
489
489
job : batch.Job {
490
490
Spec : batch.JobSpec {
491
- Completions : pointer . Int32 (2 ),
492
- BackoffLimitPerIndex : pointer . Int32 (0 ),
491
+ Completions : ptr. To [ int32 ] (2 ),
492
+ BackoffLimitPerIndex : ptr. To [ int32 ] (0 ),
493
493
},
494
494
},
495
495
pods : []* v1.Pod {
@@ -500,8 +500,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
500
500
"failed pod for active index; the pod's deletion is not delayed as it is already replaced" : {
501
501
job : batch.Job {
502
502
Spec : batch.JobSpec {
503
- Completions : pointer . Int32 (2 ),
504
- BackoffLimitPerIndex : pointer . Int32 (1 ),
503
+ Completions : ptr. To [ int32 ] (2 ),
504
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
505
505
},
506
506
},
507
507
pods : []* v1.Pod {
@@ -513,8 +513,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
513
513
"failed pod for succeeded index; the pod's deletion is not delayed as it is already replaced" : {
514
514
job : batch.Job {
515
515
Spec : batch.JobSpec {
516
- Completions : pointer . Int32 (2 ),
517
- BackoffLimitPerIndex : pointer . Int32 (1 ),
516
+ Completions : ptr. To [ int32 ] (2 ),
517
+ BackoffLimitPerIndex : ptr. To [ int32 ] (1 ),
518
518
},
519
519
},
520
520
pods : []* v1.Pod {
@@ -526,8 +526,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
526
526
"multiple failed pods for index with different failure count; only the pod with highest failure count is kept" : {
527
527
job : batch.Job {
528
528
Spec : batch.JobSpec {
529
- Completions : pointer . Int32 (2 ),
530
- BackoffLimitPerIndex : pointer . Int32 (4 ),
529
+ Completions : ptr. To [ int32 ] (2 ),
530
+ BackoffLimitPerIndex : ptr. To [ int32 ] (4 ),
531
531
},
532
532
},
533
533
pods : []* v1.Pod {
@@ -540,8 +540,8 @@ func TestGetPodsWithDelayedDeletionPerIndex(t *testing.T) {
540
540
"multiple failed pods for index with different finish times; only the last failed pod is kept" : {
541
541
job : batch.Job {
542
542
Spec : batch.JobSpec {
543
- Completions : pointer . Int32 (2 ),
544
- BackoffLimitPerIndex : pointer . Int32 (4 ),
543
+ Completions : ptr. To [ int32 ] (2 ),
544
+ BackoffLimitPerIndex : ptr. To [ int32 ] (4 ),
545
545
},
546
546
},
547
547
pods : []* v1.Pod {
0 commit comments