Skip to content

Commit 57b7d93

Browse files
Enable session affinity to handle load accross multiple replicas
1 parent 79e7b9a commit 57b7d93

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

infra/avm/main.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ module containerApp './modules/compute/container-app.bicep' = {
12361236
module containerAppMcp './modules/compute/container-app.bicep' = {
12371237
name: take('module.container-app-mcp.${solutionName}', 64)
12381238
params: {
1239+
enableSessionAffinity : enableScalability? true: false
12391240
name: 'ca-mcp-${solutionSuffix}'
12401241
location: location
12411242
tags: tags

infra/avm/main.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.44.1.10279",
9-
"templateHash": "8714866940320286579"
9+
"templateHash": "3428880183705727582"
1010
},
1111
"name": "Multi-Agent Custom Automation Engine - AVM",
1212
"description": "AVM orchestrator for the Multi-Agent Custom Automation Engine accelerator. Deploys the same logical resources and preserves the same outputs as infra\\main.bicep using local AVM wrapper modules."
@@ -51004,7 +51004,7 @@
5100451004
"_generator": {
5100551005
"name": "bicep",
5100651006
"version": "0.44.1.10279",
51007-
"templateHash": "9906697545075116207"
51007+
"templateHash": "5778435438637774225"
5100851008
}
5100951009
},
5101051010
"parameters": {
@@ -51142,6 +51142,13 @@
5114251142
"metadata": {
5114351143
"description": "Enable Azure telemetry collection."
5114451144
}
51145+
},
51146+
"enableSessionAffinity": {
51147+
"type": "bool",
51148+
"defaultValue": false,
51149+
"metadata": {
51150+
"description": "Enable sticky session affinity."
51151+
}
5114551152
}
5114651153
},
5114751154
"resources": {
@@ -51173,6 +51180,7 @@
5117351180
"containers": {
5117451181
"value": "[parameters('containers')]"
5117551182
},
51183+
"stickySessionsAffinity": "[if(parameters('enableSessionAffinity'), createObject('value', 'sticky'), createObject('value', 'none'))]",
5117651184
"ingressExternal": "[if(parameters('disableIngress'), createObject('value', false()), createObject('value', parameters('ingressExternal')))]",
5117751185
"ingressTargetPort": {
5117851186
"value": "[parameters('ingressTargetPort')]"
@@ -52788,6 +52796,7 @@
5278852796
},
5278952797
"mode": "Incremental",
5279052798
"parameters": {
52799+
"enableSessionAffinity": "[if(parameters('enableScalability'), createObject('value', true()), createObject('value', false()))]",
5279152800
"name": {
5279252801
"value": "[format('ca-mcp-{0}', variables('solutionSuffix'))]"
5279352802
},
@@ -52920,7 +52929,7 @@
5292052929
"_generator": {
5292152930
"name": "bicep",
5292252931
"version": "0.44.1.10279",
52923-
"templateHash": "9906697545075116207"
52932+
"templateHash": "5778435438637774225"
5292452933
}
5292552934
},
5292652935
"parameters": {
@@ -53058,6 +53067,13 @@
5305853067
"metadata": {
5305953068
"description": "Enable Azure telemetry collection."
5306053069
}
53070+
},
53071+
"enableSessionAffinity": {
53072+
"type": "bool",
53073+
"defaultValue": false,
53074+
"metadata": {
53075+
"description": "Enable sticky session affinity."
53076+
}
5306153077
}
5306253078
},
5306353079
"resources": {
@@ -53089,6 +53105,7 @@
5308953105
"containers": {
5309053106
"value": "[parameters('containers')]"
5309153107
},
53108+
"stickySessionsAffinity": "[if(parameters('enableSessionAffinity'), createObject('value', 'sticky'), createObject('value', 'none'))]",
5309253109
"ingressExternal": "[if(parameters('disableIngress'), createObject('value', false()), createObject('value', parameters('ingressExternal')))]",
5309353110
"ingressTargetPort": {
5309453111
"value": "[parameters('ingressTargetPort')]"

infra/avm/modules/compute/container-app.bicep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ param workloadProfileName string?
6262
@description('Enable Azure telemetry collection.')
6363
param enableTelemetry bool = true
6464

65+
@description('Enable sticky session affinity.')
66+
param enableSessionAffinity bool = false
67+
6568
// ============================================================================
6669
// Container App (AVM)
6770
// ============================================================================
@@ -74,6 +77,7 @@ module containerApp 'br/public:avm/res/app/container-app:0.22.1' = {
7477
enableTelemetry: enableTelemetry
7578
environmentResourceId: environmentResourceId
7679
containers: containers
80+
stickySessionsAffinity: enableSessionAffinity? 'sticky': 'none'
7781
ingressExternal: disableIngress ? false : ingressExternal
7882
ingressTargetPort: ingressTargetPort
7983
ingressTransport: ingressTransport

0 commit comments

Comments
 (0)