Skip to content

Commit 404bda6

Browse files
committed
add config map volumes mount for coal config
1 parent a953fe6 commit 404bda6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import io.argoproj.workflow.models.IoArgoprojWorkflowV1alpha1Template
1919
import io.argoproj.workflow.models.IoArgoprojWorkflowV1alpha1Workflow
2020
import io.argoproj.workflow.models.IoArgoprojWorkflowV1alpha1WorkflowSpec
2121
import io.kubernetes.client.custom.Quantity
22+
import io.kubernetes.client.openapi.models.V1ConfigMapVolumeSource
2223
import io.kubernetes.client.openapi.models.V1Container
2324
import io.kubernetes.client.openapi.models.V1EnvFromSource
2425
import io.kubernetes.client.openapi.models.V1EnvVar
@@ -43,6 +44,8 @@ internal const val VOLUME_CLAIM_DATASETS_SUBPATH = "datasetsdir"
4344
internal const val VOLUME_CLAIM_PARAMETERS_SUBPATH = "parametersdir"
4445
internal const val VOLUME_CLAIM_OUTPUT_SUBPATH = "outputdir"
4546
internal const val VOLUME_CLAIM_TEMP_SUBPATH = "tempdir"
47+
48+
private const val VOLUME_COAL_PATH = "/mnt/coal"
4649
private const val VOLUME_DATASETS_PATH = "/mnt/scenariorun-data"
4750
private const val VOLUME_PARAMETERS_PATH = "/mnt/scenariorun-parameters"
4851
private const val VOLUME_OUTPUT_PATH = "/pkg/share/Simulation/Output"
@@ -67,6 +70,13 @@ internal fun buildTemplate(
6770
}
6871
}
6972

73+
val configMapMount =
74+
listOf(
75+
V1VolumeMount()
76+
.name("coal-config")
77+
.mountPath(VOLUME_COAL_PATH)
78+
.subPath(VOLUME_COAL_PATH + "/" + "${organizationId}-${workspaceId}-coal-config")
79+
)
7080
val secretVolumeMount =
7181
csmPlatformProperties.argo.workflows.secrets.map { secret ->
7282
V1VolumeMount().name(secret.name).mountPath(VOLUME_SECRETS_PATH + "/" + secret.name)
@@ -91,7 +101,7 @@ internal fun buildTemplate(
91101
.subPath(VOLUME_CLAIM_TEMP_SUBPATH),
92102
)
93103

94-
val volumeMounts = normalVolumeMount + secretVolumeMount
104+
val volumeMounts = normalVolumeMount + secretVolumeMount + configMapMount
95105

96106
val sizingInfo = runContainer.runSizing ?: BASIC_SIZING.toContainerResourceSizing()
97107

@@ -193,6 +203,15 @@ internal fun buildWorkflowSpec(
193203
.entrypoint(CSM_DAG_ENTRYPOINT)
194204
.templates(templates)
195205
.volumeClaimTemplates(buildVolumeClaims(csmPlatformProperties))
206+
.addVolumesItem(
207+
V1Volume()
208+
.name("coal-config")
209+
.configMap(
210+
V1ConfigMapVolumeSource()
211+
.name("${organizationId}-${workspaceId}-coal-config")
212+
.optional(true)
213+
)
214+
)
196215

197216
if (csmPlatformProperties.argo.workflows.secrets.isNotEmpty()) {
198217
val argoSecrets = csmPlatformProperties.argo.workflows.secrets

0 commit comments

Comments
 (0)