Skip to content

Commit ba3b054

Browse files
committed
use IfNotPresent strategy for argo images and main simulator images
1 parent c339103 commit ba3b054

File tree

5 files changed

+45
-21
lines changed

5 files changed

+45
-21
lines changed

api/kubernetes/deploy_via_helm-dev.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,31 @@ metadata:
109109
app: postgres
110110
name: ${ARGO_POSTGRESQL_SECRET_NAME}
111111
stringData:
112-
password: ${ARGO_POSTGRESQL_PASSWORD}
113-
username: ${ARGO_POSTGRESQL_USER}
112+
password: "${ARGO_POSTGRESQL_PASSWORD}"
113+
username: "${ARGO_POSTGRESQL_USER}"
114114
type: Opaque
115115
116116
EOF
117117
kubectl apply -n ${NAMESPACE} -f postgres-secret.yaml
118118

119119
# Argo
120120
cat <<EOF > values-argo.yaml
121+
images:
122+
pullPolicy: IfNotPresent
121123
workflow:
122124
serviceAccount:
123125
create: true
124-
name: workflow
126+
name: workflowcsmv2
125127
rbac:
126128
create: true
127129
executor:
128130
env:
129131
- name: RESOURCE_STATE_CHECK_INTERVAL
130132
value: 1s
133+
- name: WAIT_CONTAINER_STATUS_CHECK_INTERVAL
134+
value: 1s
135+
- name: RECENTLY_STARTED_POD_DURATION
136+
value: 1s
131137
artifactRepository:
132138
archiveLogs: true
133139
s3:
@@ -187,6 +193,8 @@ controller:
187193
passwordSecret:
188194
name: "${ARGO_POSTGRESQL_SECRET_NAME}"
189195
key: password
196+
mainContainer:
197+
imagePullPolicy: IfNotPresent
190198
191199
EOF
192200

api/kubernetes/deploy_via_helm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ kubectl apply -n ${NAMESPACE} -f postgres-secret.yaml
287287
# Argo
288288
cat <<EOF > values-argo.yaml
289289
images:
290-
imagePullPolicy: "IfNotPresent"
290+
pullPolicy: IfNotPresent
291291
workflow:
292292
serviceAccount:
293293
create: true
@@ -360,7 +360,7 @@ controller:
360360
name: "${ARGO_POSTGRESQL_SECRET_NAME}"
361361
key: password
362362
mainContainer:
363-
imagePullPolicy: "IfNotPresent"
363+
imagePullPolicy: IfNotPresent
364364
365365
EOF
366366

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ group = "com.cosmotech"
4040
version = scmVersion.version
4141

4242
val kotlinJvmTarget = 17
43-
val cosmotechApiCommonVersion = "0.1.6-SNAPSHOT"
43+
val cosmotechApiCommonVersion = "0.1.7-SNAPSHOT"
4444
val cosmotechApiAzureVersion = "0.1.5-SNAPSHOT"
4545
val azureSpringBootBomVersion = "3.14.0"
4646

scenariorun/src/main/kotlin/com/cosmotech/scenariorun/workflow/argo/WorkflowBuilders.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ private const val VOLUME_DATASETS_PATH = "/mnt/scenariorun-data"
3636
private const val VOLUME_PARAMETERS_PATH = "/mnt/scenariorun-parameters"
3737
private const val CSM_ARGO_WORKFLOWS_TIMEOUT = 28800
3838

39-
internal fun buildTemplate(scenarioRunContainer: ScenarioRunContainer): Template {
39+
internal fun buildTemplate(
40+
scenarioRunContainer: ScenarioRunContainer,
41+
csmPlatformProperties: CsmPlatformProperties
42+
): Template {
4043
var envVars: MutableList<V1EnvVar>? = null
4144
if (scenarioRunContainer.envVars != null) {
4245
envVars = mutableListOf()
@@ -60,7 +63,7 @@ internal fun buildTemplate(scenarioRunContainer: ScenarioRunContainer): Template
6063
val container =
6164
V1Container()
6265
.image(scenarioRunContainer.image)
63-
.imagePullPolicy("Always")
66+
.imagePullPolicy(csmPlatformProperties.argo.imagePullPolicy)
6467
.env(envVars)
6568
.args(scenarioRunContainer.runArgs)
6669
.volumeMounts(volumeMounts)
@@ -99,7 +102,10 @@ internal fun buildWorkflowSpec(
99102
nodeSelector[csmPlatformProperties.argo.workflows.nodePoolLabel] = startContainers.nodeLabel
100103
}
101104
val templates =
102-
startContainers.containers.map { container -> buildTemplate(container) }.toMutableList()
105+
startContainers
106+
.containers
107+
.map { container -> buildTemplate(container, csmPlatformProperties) }
108+
.toMutableList()
103109
val entrypointTemplate = buildEntrypointTemplate(startContainers)
104110
templates.add(entrypointTemplate)
105111

scenariorun/src/test/kotlin/com/cosmotech/scenariorun/workflow/argo/WorkflowBuildersTests.kt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,31 @@ class WorkflowBuildersTests {
3636
@Test
3737
fun `Template not null`() {
3838
val src = getScenarioRunContainer()
39-
val template = buildTemplate(src)
39+
val template = buildTemplate(src, csmPlatformProperties)
4040
assertNotNull(template)
4141
}
4242

4343
@Test
4444
fun `Template has image`() {
4545
val src = getScenarioRunContainer()
46-
val template = buildTemplate(src)
46+
val template = buildTemplate(src, csmPlatformProperties)
4747
assertEquals(src.image, template.container?.image)
4848
}
4949

50+
@Test
51+
fun `Template has image pull policy set to IfNotPresent`() {
52+
every { csmPlatformProperties.argo.imagePullPolicy } returns "IfNotPresent"
53+
val src = getScenarioRunContainer()
54+
val template = buildTemplate(src, csmPlatformProperties)
55+
assertNotNull(template.container)
56+
assertEquals("IfNotPresent", template.container!!.imagePullPolicy)
57+
}
58+
5059
@Test
5160
fun `Template has image pull policy set to Always`() {
61+
every { csmPlatformProperties.argo.imagePullPolicy } returns "Always"
5262
val src = getScenarioRunContainer()
53-
val template = buildTemplate(src)
63+
val template = buildTemplate(src, csmPlatformProperties)
5464
assertNotNull(template.container)
5565
assertEquals("Always", template.container!!.imagePullPolicy)
5666
}
@@ -59,57 +69,57 @@ class WorkflowBuildersTests {
5969
fun `Template has name`() {
6070
val name = "template name"
6171
val src = getScenarioRunContainer(name)
62-
val template = buildTemplate(src)
72+
val template = buildTemplate(src, csmPlatformProperties)
6373
assertEquals(name, template.name)
6474
}
6575

6676
@Test
6777
fun `Template has args`() {
6878
val src = getScenarioRunContainerArgs()
69-
val template = buildTemplate(src)
79+
val template = buildTemplate(src, csmPlatformProperties)
7080
assertEquals(src.runArgs, template.container?.args)
7181
}
7282

7383
@Test
7484
fun `Template has no args`() {
7585
val src = getScenarioRunContainer()
76-
val template = buildTemplate(src)
86+
val template = buildTemplate(src, csmPlatformProperties)
7787
assertEquals(src.runArgs, template.container?.args)
7888
}
7989

8090
@Test
8191
fun `Template has simulator default entrypoint`() {
8292
val src = getScenarioRunContainerEntrypoint()
83-
val template = buildTemplate(src)
93+
val template = buildTemplate(src, csmPlatformProperties)
8494
assertEquals(listOf(DEFAULT_ENTRY_POINT), template.container?.command)
8595
}
8696

8797
@Test
8898
fun `Template has simulator no entrypoint`() {
8999
val src = getScenarioRunContainer()
90-
val template = buildTemplate(src)
100+
val template = buildTemplate(src, csmPlatformProperties)
91101
assertNull(template.container?.command)
92102
}
93103

94104
@Test
95105
fun `Template has default entrypoint if not defined`() {
96106
val src = getScenarioRunContainer()
97-
val template = buildTemplate(src)
107+
val template = buildTemplate(src, csmPlatformProperties)
98108
val expected: String? = null
99109
assertEquals(expected, template.container?.command)
100110
}
101111

102112
@Test
103113
fun `Template has default env var`() {
104114
val src = getScenarioRunContainer()
105-
val template = buildTemplate(src)
115+
val template = buildTemplate(src, csmPlatformProperties)
106116
assertNull(template.container?.env)
107117
}
108118

109119
@Test
110120
fun `Template has env var`() {
111121
val src = getScenarioRunContainerEnv()
112-
val template = buildTemplate(src)
122+
val template = buildTemplate(src, csmPlatformProperties)
113123
val expected =
114124
listOf(
115125
V1EnvVar().name("env1").value("envvar1"),
@@ -411,7 +421,7 @@ class WorkflowBuildersTests {
411421
@Test
412422
fun `Create Template with StartContainers volume mount`() {
413423
val src = getScenarioRunContainer()
414-
val template = buildTemplate(src)
424+
val template = buildTemplate(src, csmPlatformProperties)
415425
val expected =
416426
listOf(
417427
V1VolumeMount()

0 commit comments

Comments
 (0)