@@ -274,12 +274,11 @@ internal class ContainerFactory(
274274 nodeLabel : String = NODE_LABEL_DEFAULT
275275 ): ScenarioRunStartContainers {
276276
277- val defaultSizing =
278- if (nodeLabel != null ) {
279- (LABEL_SIZING [nodeLabel] ? : BASIC_SIZING )
280- } else {
281- (BASIC_SIZING )
282- }
277+ var defaultSizing = BASIC_SIZING
278+
279+ if (nodeLabel != null ) {
280+ defaultSizing = LABEL_SIZING [nodeLabel] ? : BASIC_SIZING
281+ }
283282
284283 val container =
285284 buildSimpleContainer(
@@ -324,70 +323,6 @@ internal class ContainerFactory(
324323 runSizing = nodeSizing.toContainerResourceSizing())
325324 }
326325
327- internal fun getMinimalCommonEnvVars (
328- csmPlatformProperties : CsmPlatformProperties ,
329- azureManagedIdentity : Boolean? = null,
330- azureAuthenticationWithCustomerAppRegistration : Boolean? = null,
331- ): MutableMap <String , String > {
332- if (azureManagedIdentity == true && azureAuthenticationWithCustomerAppRegistration == true ) {
333- throw IllegalArgumentException (
334- " Don't know which authentication mechanism to use to connect " +
335- " against Azure services. Both azureManagedIdentity and " +
336- " azureAuthenticationWithCustomerAppRegistration cannot be set to true" )
337- }
338- val identityEnvVars =
339- if (azureManagedIdentity == true ) {
340- mapOf (CSM_AZURE_MANAGED_IDENTITY_VAR to " true" )
341- } else if (azureAuthenticationWithCustomerAppRegistration == true ) {
342- mapOf (
343- AZURE_TENANT_ID_VAR to
344- (csmPlatformProperties.azure?.credentials?.customer?.tenantId!! ),
345- AZURE_CLIENT_ID_VAR to
346- (csmPlatformProperties.azure?.credentials?.customer?.clientId!! ),
347- AZURE_CLIENT_SECRET_VAR to
348- (csmPlatformProperties.azure?.credentials?.customer?.clientSecret!! ),
349- )
350- } else {
351- mapOf (
352- AZURE_TENANT_ID_VAR to (csmPlatformProperties.azure?.credentials?.core?.tenantId!! ),
353- AZURE_CLIENT_ID_VAR to (csmPlatformProperties.azure?.credentials?.core?.clientId!! ),
354- AZURE_CLIENT_SECRET_VAR to
355- (csmPlatformProperties.azure?.credentials?.core?.clientSecret!! ),
356- )
357- }
358- val oktaEnvVars: MutableMap <String , String > = mutableMapOf ()
359- if (csmPlatformProperties.identityProvider?.code == " okta" ) {
360- oktaEnvVars.putAll(
361- mapOf (
362- OKTA_CLIENT_ID to (csmPlatformProperties.okta?.clientId!! ),
363- OKTA_CLIENT_SECRET to (csmPlatformProperties.okta?.clientSecret!! ),
364- OKTA_CLIENT_ISSUER to (csmPlatformProperties.okta?.issuer!! ),
365- ))
366- }
367-
368- val twinCacheEnvVars: MutableMap <String , String > = mutableMapOf ()
369- if (csmPlatformProperties.twincache != null ) {
370- val twinCacheInfo = csmPlatformProperties.twincache!!
371- twinCacheEnvVars.putAll(
372- mapOf (
373- TWIN_CACHE_HOST to (twinCacheInfo.host),
374- TWIN_CACHE_PORT to (twinCacheInfo.port),
375- TWIN_CACHE_PASSWORD to (twinCacheInfo.password),
376- TWIN_CACHE_USERNAME to (twinCacheInfo.username),
377- ))
378- }
379- val containerScopes = getContainerScopes(csmPlatformProperties)
380- val commonEnvVars =
381- mapOf (
382- IDENTITY_PROVIDER to (csmPlatformProperties.identityProvider?.code ? : " azure" ),
383- API_BASE_URL_VAR to csmPlatformProperties.api.baseUrl,
384- API_BASE_SCOPE_VAR to containerScopes,
385- DATASET_PATH_VAR to DATASET_PATH ,
386- PARAMETERS_PATH_VAR to PARAMETERS_PATH ,
387- )
388- return (identityEnvVars + commonEnvVars + oktaEnvVars + twinCacheEnvVars).toMutableMap()
389- }
390-
391326 internal fun buildContainersStart (
392327 scenario : Scenario ,
393328 datasets : List <Dataset >? ,
@@ -416,12 +351,11 @@ internal class ContainerFactory(
416351
417352 val runTemplateSizing = template.runSizing?.toSizing()
418353
419- val defaultSizing =
420- if (nodeLabel != null ) {
421- (LABEL_SIZING [nodeLabel] ? : BASIC_SIZING )
422- } else {
423- (BASIC_SIZING )
424- }
354+ var defaultSizing = BASIC_SIZING
355+
356+ if (nodeLabel != null ) {
357+ defaultSizing = LABEL_SIZING [nodeLabel] ? : BASIC_SIZING
358+ }
425359
426360 val containers =
427361 buildContainersPipeline(
@@ -1534,14 +1468,8 @@ internal fun getContainerScopes(csmPlatformProperties: CsmPlatformProperties): S
15341468 return " ${csmPlatformProperties.azure?.appIdUri}${API_SCOPE_SUFFIX } "
15351469}
15361470
1537- @Suppress(" LongMethod" )
1538- internal fun getCommonEnvVars (
1471+ internal fun getMinimalCommonEnvVars (
15391472 csmPlatformProperties : CsmPlatformProperties ,
1540- csmSimulationId : String ,
1541- organizationId : String ,
1542- workspaceId : String ,
1543- scenarioId : String ,
1544- workspaceKey : String ,
15451473 azureManagedIdentity : Boolean? = null,
15461474 azureAuthenticationWithCustomerAppRegistration : Boolean? = null,
15471475): MutableMap <String , String > {
@@ -1590,16 +1518,38 @@ internal fun getCommonEnvVars(
15901518 TWIN_CACHE_USERNAME to (twinCacheInfo.username),
15911519 ))
15921520 }
1593-
15941521 val containerScopes = getContainerScopes(csmPlatformProperties)
15951522 val commonEnvVars =
15961523 mapOf (
15971524 IDENTITY_PROVIDER to (csmPlatformProperties.identityProvider?.code ? : " azure" ),
1598- CSM_SIMULATION_ID to csmSimulationId,
15991525 API_BASE_URL_VAR to csmPlatformProperties.api.baseUrl,
16001526 API_BASE_SCOPE_VAR to containerScopes,
16011527 DATASET_PATH_VAR to DATASET_PATH ,
16021528 PARAMETERS_PATH_VAR to PARAMETERS_PATH ,
1529+ )
1530+ return (identityEnvVars + commonEnvVars + oktaEnvVars + twinCacheEnvVars).toMutableMap()
1531+ }
1532+
1533+ internal fun getCommonEnvVars (
1534+ csmPlatformProperties : CsmPlatformProperties ,
1535+ csmSimulationId : String ,
1536+ organizationId : String ,
1537+ workspaceId : String ,
1538+ scenarioId : String ,
1539+ workspaceKey : String ,
1540+ azureManagedIdentity : Boolean? = null,
1541+ azureAuthenticationWithCustomerAppRegistration : Boolean? = null,
1542+ ): MutableMap <String , String > {
1543+
1544+ val minimalEnvVars =
1545+ getMinimalCommonEnvVars(
1546+ csmPlatformProperties,
1547+ azureManagedIdentity,
1548+ azureAuthenticationWithCustomerAppRegistration)
1549+
1550+ val commonEnvVars =
1551+ mapOf (
1552+ CSM_SIMULATION_ID to csmSimulationId,
16031553 AZURE_DATA_EXPLORER_RESOURCE_URI_VAR to
16041554 (csmPlatformProperties.azure?.dataWarehouseCluster?.baseUri ? : " " ),
16051555 AZURE_DATA_EXPLORER_RESOURCE_INGEST_URI_VAR to
@@ -1609,7 +1559,7 @@ internal fun getCommonEnvVars(
16091559 PARAMETERS_WORKSPACE_VAR to workspaceId,
16101560 PARAMETERS_SCENARIO_VAR to scenarioId,
16111561 )
1612- return (identityEnvVars + commonEnvVars + oktaEnvVars + twinCacheEnvVars ).toMutableMap()
1562+ return (minimalEnvVars + commonEnvVars).toMutableMap()
16131563}
16141564
16151565private fun stackSolutionContainers (
0 commit comments