@@ -306,6 +306,7 @@ func TestHookExecutor_makeHookPod(t *testing.T) {
306
306
Value : deploymentNamespace ,
307
307
},
308
308
},
309
+ ImagePullPolicy : kapi .PullIfNotPresent ,
309
310
Resources : kapi.ResourceRequirements {
310
311
Limits : kapi.ResourceList {
311
312
kapi .ResourceCPU : resource .MustParse ("10" ),
@@ -370,6 +371,7 @@ func TestHookExecutor_makeHookPod(t *testing.T) {
370
371
Value : deploymentNamespace ,
371
372
},
372
373
},
374
+ ImagePullPolicy : kapi .PullIfNotPresent ,
373
375
Resources : kapi.ResourceRequirements {
374
376
Limits : kapi.ResourceList {
375
377
kapi .ResourceCPU : resource .MustParse ("10" ),
@@ -429,6 +431,7 @@ func TestHookExecutor_makeHookPod(t *testing.T) {
429
431
Value : deploymentNamespace ,
430
432
},
431
433
},
434
+ ImagePullPolicy : kapi .PullIfNotPresent ,
432
435
Resources : kapi.ResourceRequirements {
433
436
Limits : kapi.ResourceList {
434
437
kapi .ResourceCPU : resource .MustParse ("10" ),
@@ -451,6 +454,54 @@ func TestHookExecutor_makeHookPod(t *testing.T) {
451
454
},
452
455
strategyAnnotations : map [string ]string {"annotation2" : "value2" },
453
456
},
457
+ {
458
+ name : "allways pull image" ,
459
+ hook : & deployapi.LifecycleHook {
460
+ FailurePolicy : deployapi .LifecycleHookFailurePolicyAbort ,
461
+ ExecNewPod : & deployapi.ExecNewPodHook {
462
+ ContainerName : "container2" ,
463
+ },
464
+ },
465
+ expected : & kapi.Pod {
466
+ ObjectMeta : kapi.ObjectMeta {
467
+ Name : namer .GetPodName (deploymentName , "hook" ),
468
+ Labels : map [string ]string {
469
+ deployapi .DeploymentPodTypeLabel : "hook" ,
470
+ deployapi .DeployerPodForDeploymentLabel : deploymentName ,
471
+ },
472
+ Annotations : map [string ]string {
473
+ deployapi .DeploymentAnnotation : deploymentName ,
474
+ },
475
+ },
476
+ Spec : kapi.PodSpec {
477
+ RestartPolicy : kapi .RestartPolicyNever ,
478
+ ActiveDeadlineSeconds : & maxDeploymentDurationSeconds ,
479
+ Containers : []kapi.Container {
480
+ {
481
+ Name : "lifecycle" ,
482
+ Image : "registry:8080/repo1:ref2" ,
483
+ Env : []kapi.EnvVar {
484
+ {
485
+ Name : "OPENSHIFT_DEPLOYMENT_NAME" ,
486
+ Value : deploymentName ,
487
+ },
488
+ {
489
+ Name : "OPENSHIFT_DEPLOYMENT_NAMESPACE" ,
490
+ Value : deploymentNamespace ,
491
+ },
492
+ },
493
+ ImagePullPolicy : kapi .PullAlways ,
494
+ },
495
+ },
496
+ TerminationGracePeriodSeconds : & gracePeriod ,
497
+ ImagePullSecrets : []kapi.LocalObjectReference {
498
+ {
499
+ Name : "secret-1" ,
500
+ },
501
+ },
502
+ },
503
+ },
504
+ },
454
505
}
455
506
456
507
for _ , test := range tests {
@@ -670,7 +721,7 @@ func deployment(name, namespace string, strategyLabels, strategyAnnotations map[
670
721
{
671
722
Name : "container2" ,
672
723
Image : "registry:8080/repo1:ref2" ,
673
- ImagePullPolicy : kapi .PullIfNotPresent ,
724
+ ImagePullPolicy : kapi .PullAlways ,
674
725
},
675
726
},
676
727
Volumes : []kapi.Volume {
0 commit comments