Skip to content

Commit 01eed37

Browse files
committed
add const for volume mount var
1 parent d9c61ca commit 01eed37

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ import io.kubernetes.client.openapi.models.V1VolumeResourceRequirements
3939
private const val CSM_DAG_ENTRYPOINT = "entrypoint"
4040
private const val CSM_DEFAULT_WORKFLOW_NAME = "default-workflow-"
4141
internal const val VOLUME_SECRET_NAME = "secrets"
42+
internal const val VOLUME_CLAIM_COAL = "coal-config"
4243
internal const val VOLUME_CLAIM = "datadir"
4344
internal const val VOLUME_CLAIM_DATASETS_SUBPATH = "datasetsdir"
4445
internal const val VOLUME_CLAIM_PARAMETERS_SUBPATH = "parametersdir"
4546
internal const val VOLUME_CLAIM_OUTPUT_SUBPATH = "outputdir"
4647
internal const val VOLUME_CLAIM_TEMP_SUBPATH = "tempdir"
4748
internal const val VOLUME_COAL_PATH = "/mnt/coal"
49+
internal const val VOLUME_COAL_FILE_NAME = "coal-config.toml"
4850

4951
private const val VOLUME_DATASETS_PATH = "/mnt/scenariorun-data"
5052
private const val VOLUME_PARAMETERS_PATH = "/mnt/scenariorun-parameters"
@@ -74,9 +76,9 @@ internal fun buildTemplate(
7476
val configMapMount =
7577
listOf(
7678
V1VolumeMount()
77-
.name("coal-config")
78-
.mountPath(VOLUME_COAL_PATH + "/coal-config.toml")
79-
.subPath("coal-config.toml")
79+
.name(VOLUME_CLAIM_COAL)
80+
.mountPath(VOLUME_COAL_PATH + "/" + VOLUME_COAL_FILE_NAME)
81+
.subPath(VOLUME_COAL_FILE_NAME)
8082
)
8183
val secretVolumeMount =
8284
csmPlatformProperties.argo.workflows.secrets.map { secret ->
@@ -202,13 +204,13 @@ internal fun buildWorkflowSpec(
202204
.volumeClaimTemplates(buildVolumeClaims(csmPlatformProperties))
203205
.addVolumesItem(
204206
V1Volume()
205-
.name("coal-config")
207+
.name(VOLUME_CLAIM_COAL)
206208
.configMap(
207209
V1ConfigMapVolumeSource()
208210
.optional(true)
209211
.name("${organizationId}-${workspaceId}-coal-config")
210212
.addItemsItem(
211-
V1KeyToPath().key("coal-config.toml").path("coal-config.toml")
213+
V1KeyToPath().key(VOLUME_COAL_FILE_NAME).path(VOLUME_COAL_FILE_NAME)
212214
)
213215
)
214216
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ class WorkflowBuildersTests {
482482
.mountPath("/usr/tmp")
483483
.subPath(VOLUME_CLAIM_TEMP_SUBPATH),
484484
V1VolumeMount()
485-
.name("coal-config")
486-
.mountPath(VOLUME_COAL_PATH + "/coal-config.toml")
487-
.subPath("coal-config.toml"),
485+
.name(VOLUME_CLAIM_COAL)
486+
.mountPath(VOLUME_COAL_PATH + "/" + VOLUME_COAL_FILE_NAME)
487+
.subPath(VOLUME_COAL_FILE_NAME),
488488
)
489489
assertEquals(expected, template.container?.volumeMounts)
490490
}

0 commit comments

Comments
 (0)