@@ -311,6 +311,7 @@ func TestDesiredDaemonSet(t *testing.T) {
311311
312312	testContourImage  :=  "ghcr.io/projectcontour/contour:test" 
313313	testEnvoyImage  :=  "docker.io/envoyproxy/envoy:test" 
314+ 	testImagePullSecret  :=  "" 
314315	testLogLevelArg  :=  "--log-level debug" 
315316	testBaseIDArg  :=  "--base-id 1" 
316317	testEnvoyMaxHeapSize  :=  "--overload-max-heap=8000000000" 
@@ -343,7 +344,7 @@ func TestDesiredDaemonSet(t *testing.T) {
343344	cntr .Spec .EnvoyMaxHeapSizeBytes  =  8000000000 
344345	cntr .Spec .EnvoyMaxDownstreamConnections  =  42 
345346
346- 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage )
347+ 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage ,  testImagePullSecret )
347348	container  :=  checkDaemonSetHasContainer (t , ds , EnvoyContainerName , true )
348349	checkContainerHasArg (t , container , testLogLevelArg )
349350	checkContainerHasArg (t , container , testBaseIDArg )
@@ -386,7 +387,8 @@ func TestDesiredDeployment(t *testing.T) {
386387
387388	testContourImage  :=  "ghcr.io/projectcontour/contour:test" 
388389	testEnvoyImage  :=  "docker.io/envoyproxy/envoy:test" 
389- 	deploy  :=  desiredDeployment (cntr , testContourImage , testEnvoyImage )
390+ 	testImagePullSecret  :=  "" 
391+ 	deploy  :=  desiredDeployment (cntr , testContourImage , testEnvoyImage , testImagePullSecret )
390392	checkDeploymentHasStrategy (t , deploy , cntr .Spec .EnvoyDeploymentStrategy )
391393	checkEnvoyDeploymentHasAffinity (t , deploy , cntr )
392394}
@@ -414,7 +416,8 @@ func TestNodePlacementDaemonSet(t *testing.T) {
414416
415417	testContourImage  :=  "ghcr.io/projectcontour/contour:test" 
416418	testEnvoyImage  :=  "docker.io/envoyproxy/envoy:test" 
417- 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage )
419+ 	testImagePullSecret  :=  "" 
420+ 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage , testImagePullSecret )
418421	checkDaemonSetHasNodeSelector (t , ds , selectors )
419422	checkDaemonSetHasTolerations (t , ds , tolerations )
420423}
@@ -436,9 +439,28 @@ func TestEnvoyCustomPorts(t *testing.T) {
436439
437440	testContourImage  :=  "ghcr.io/projectcontour/contour:test" 
438441	testEnvoyImage  :=  "docker.io/envoyproxy/envoy:test" 
439- 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage )
442+ 	testImagePullSecret  :=  "" 
443+ 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage , testImagePullSecret )
440444	checkContainerHasPort (t , ds , int32 (metricPort ))
441445
442446	container  :=  checkDaemonSetHasContainer (t , ds , EnvoyContainerName , true )
443447	checkContainerHasReadinessPort (t , container , 8020 )
444448}
449+ 
450+ func  TestDesiredDaemonSetWithImagePullSecret (t  * testing.T ) {
451+ 	name  :=  "ds-test" 
452+ 	cntr  :=  model .Default (fmt .Sprintf ("%s-ns" , name ), name )
453+ 	cntr .Spec .NetworkPublishing .Envoy .Ports  =  []model.Port {
454+ 		{Name : "http" , ServicePort : 80 , ContainerPort : 8080 },
455+ 	}
456+ 	testContourImage  :=  "ghcr.io/projectcontour/contour:test" 
457+ 	testEnvoyImage  :=  "docker.io/envoyproxy/envoy:test" 
458+ 	testImagePullSecret  :=  "my-secret" 
459+ 
460+ 	ds  :=  DesiredDaemonSet (cntr , testContourImage , testEnvoyImage , testImagePullSecret )
461+ 
462+ 	require .NotNil (t , ds )
463+ 	require .NotNil (t , ds .Spec .Template .Spec .ImagePullSecrets )
464+ 	require .Len (t , ds .Spec .Template .Spec .ImagePullSecrets , 1 )
465+ 	require .Equal (t , testImagePullSecret , ds .Spec .Template .Spec .ImagePullSecrets [0 ].Name )
466+ }
0 commit comments