@@ -26,13 +26,14 @@ function createTestYamlDeployment(
2626 newYamlPath : string ,
2727 integrationId : string ,
2828 imageNameAndTag : string ,
29+ imagePullPolicy : string ,
2930) : void {
3031 console . log ( 'Creating test deployment...' ) ;
3132 const originalDeploymentYaml = readFileSync ( './snyk-monitor-deployment.yaml' , 'utf8' ) ;
3233 const deployment = parse ( originalDeploymentYaml ) ;
3334
3435 deployment . spec . template . spec . containers [ 0 ] . image = imageNameAndTag ;
35- deployment . spec . template . spec . containers [ 0 ] . imagePullPolicy = 'Never' ;
36+ deployment . spec . template . spec . containers [ 0 ] . imagePullPolicy = imagePullPolicy ;
3637
3738 // This is important due to an odd bug when running on Travis.
3839 // By adding the Google nameserver, the container can start resolving external hosts.
@@ -105,7 +106,10 @@ async function createSecretForGcrIoAccess(): Promise<void> {
105106 ) ;
106107}
107108
108- async function installKubernetesMonitor ( imageNameAndTag : string ) : Promise < string > {
109+ async function installKubernetesMonitor (
110+ imageNameAndTag : string ,
111+ imagePullPolicy : string ,
112+ ) : Promise < string > {
109113 const namespace = 'snyk-monitor' ;
110114 await kubectl . createNamespace ( namespace ) ;
111115
@@ -118,7 +122,7 @@ async function installKubernetesMonitor(imageNameAndTag: string): Promise<string
118122 } ) ;
119123
120124 const testYaml = 'snyk-monitor-test-deployment.yaml' ;
121- createTestYamlDeployment ( testYaml , integrationId , imageNameAndTag ) ;
125+ createTestYamlDeployment ( testYaml , integrationId , imageNameAndTag , imagePullPolicy ) ;
122126
123127 await kubectl . applyK8sYaml ( './snyk-monitor-cluster-permissions.yaml' ) ;
124128 await kubectl . applyK8sYaml ( './snyk-monitor-test-deployment.yaml' ) ;
@@ -146,7 +150,11 @@ export async function deployMonitor(): Promise<string> {
146150 await platforms [ testPlatform ] . config ( ) ;
147151 await createEnvironment ( ) ;
148152 await createSecretForGcrIoAccess ( ) ;
149- const integrationId = await installKubernetesMonitor ( remoteImageName ) ;
153+
154+ // TODO: hack, rewrite this
155+ const imagePullPolicy = testPlatform === 'kind' ? 'Never' : 'Always' ;
156+
157+ const integrationId = await installKubernetesMonitor ( remoteImageName , imagePullPolicy ) ;
150158 await waiters . waitForMonitorToBeReady ( ) ;
151159 console . log ( `Deployed the snyk-monitor with integration ID ${ integrationId } ` ) ;
152160 return integrationId ;
0 commit comments