Skip to content

Commit a4cbfc1

Browse files
fix: Enable session affinity to handle load accross multiple replicas
2 parents d64afbe + 69c0e31 commit a4cbfc1

3 files changed

Lines changed: 41 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+
stickySessionsAffinity : enableScalability? 'sticky': 'none'
12391240
name: 'ca-mcp-${solutionSuffix}'
12401241
location: location
12411242
tags: tags

infra/avm/main.json

Lines changed: 32 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": "2099326972124864634"
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": "10535819316717631477"
5100851008
}
5100951009
},
5101051010
"parameters": {
@@ -51142,6 +51142,17 @@
5114251142
"metadata": {
5114351143
"description": "Enable Azure telemetry collection."
5114451144
}
51145+
},
51146+
"stickySessionsAffinity": {
51147+
"type": "string",
51148+
"defaultValue": "none",
51149+
"allowedValues": [
51150+
"none",
51151+
"sticky"
51152+
],
51153+
"metadata": {
51154+
"description": "Optional. Bool indicating if the Container App should enable session affinity."
51155+
}
5114551156
}
5114651157
},
5114751158
"resources": {
@@ -51202,6 +51213,9 @@
5120251213
},
5120351214
"workloadProfileName": {
5120451215
"value": "[parameters('workloadProfileName')]"
51216+
},
51217+
"stickySessionsAffinity": {
51218+
"value": "[parameters('stickySessionsAffinity')]"
5120551219
}
5120651220
},
5120751221
"template": {
@@ -52788,6 +52802,7 @@
5278852802
},
5278952803
"mode": "Incremental",
5279052804
"parameters": {
52805+
"stickySessionsAffinity": "[if(parameters('enableScalability'), createObject('value', 'sticky'), createObject('value', 'none'))]",
5279152806
"name": {
5279252807
"value": "[format('ca-mcp-{0}', variables('solutionSuffix'))]"
5279352808
},
@@ -52920,7 +52935,7 @@
5292052935
"_generator": {
5292152936
"name": "bicep",
5292252937
"version": "0.44.1.10279",
52923-
"templateHash": "9906697545075116207"
52938+
"templateHash": "10535819316717631477"
5292452939
}
5292552940
},
5292652941
"parameters": {
@@ -53058,6 +53073,17 @@
5305853073
"metadata": {
5305953074
"description": "Enable Azure telemetry collection."
5306053075
}
53076+
},
53077+
"stickySessionsAffinity": {
53078+
"type": "string",
53079+
"defaultValue": "none",
53080+
"allowedValues": [
53081+
"none",
53082+
"sticky"
53083+
],
53084+
"metadata": {
53085+
"description": "Optional. Bool indicating if the Container App should enable session affinity."
53086+
}
5306153087
}
5306253088
},
5306353089
"resources": {
@@ -53118,6 +53144,9 @@
5311853144
},
5311953145
"workloadProfileName": {
5312053146
"value": "[parameters('workloadProfileName')]"
53147+
},
53148+
"stickySessionsAffinity": {
53149+
"value": "[parameters('stickySessionsAffinity')]"
5312153150
}
5312253151
},
5312353152
"template": {

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

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

65+
@allowed([
66+
'none'
67+
'sticky'
68+
])
69+
@description('Optional. Bool indicating if the Container App should enable session affinity.')
70+
param stickySessionsAffinity string = 'none'
71+
6572
// ============================================================================
6673
// Container App (AVM)
6774
// ============================================================================
@@ -86,6 +93,7 @@ module containerApp 'br/public:avm/res/app/container-app:0.22.1' = {
8693
activeRevisionsMode: activeRevisionsMode
8794
scaleSettings: scaleSettings
8895
workloadProfileName: workloadProfileName
96+
stickySessionsAffinity: stickySessionsAffinity
8997
}
9098
}
9199

0 commit comments

Comments
 (0)