Skip to content

Commit ce3ecd7

Browse files
Merge pull request #280883 from anthonychu/20240715-sessions-fix-arm-template
[Container Apps] Fix sessions ARM template
2 parents 3881a69 + e4ce72b commit ce3ecd7

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

articles/container-apps/sessions-custom-container.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ az containerapp sessionpool create \
6363
--registry-password <PASSWORD> \
6464
--container-type CustomContainer \
6565
--image myregistry.azurecr.io/my-container-image:1.0 \
66-
--cpu 1.0 --memory 2.0Gi \
66+
--cpu 0.25 --memory 0.5Gi \
6767
--target-port 80 \
6868
--cooldown-period 300 \
6969
--network-status EgressDisabled \
@@ -84,8 +84,8 @@ This command creates a session pool with the following settings:
8484
| `--registry-server` | `myregistry.azurecr.io` | The container registry server hostname. |
8585
| `--registry-username` | `my-username` | The username to log in to the container registry. |
8686
| `--registry-password` | `my-password` | The password to log in to the container registry. |
87-
| `--cpu` | `1.0` | The required CPU in cores. |
88-
| `--memory` | `2.0Gi` | The required memory. |
87+
| `--cpu` | `0.25` | The required CPU in cores. |
88+
| `--memory` | `0.5Gi` | The required memory. |
8989
| `--target-port` | `80` | The session port used for ingress traffic. |
9090
| `--cooldown-period` | `300` | The number of seconds that a session can be idle before the session is terminated. The idle period is reset each time the session's API is called. Value must be between `300` and `3600`. |
9191
| `--network-status` | Designates whether outbound network traffic is allowed from the session. Valid values are `EgressDisabled` (default) and `EgressEnabled`. |
@@ -103,29 +103,38 @@ Before you send the request, replace the placeholders between the `<>` brackets
103103

104104
```json
105105
{
106-
"type": "Microsoft.ContainerApps/sessionPools",
106+
"type": "Microsoft.App/sessionPools",
107107
"apiVersion": "2024-02-02-preview",
108108
"name": "my-session-pool",
109109
"location": "westus2",
110110
"properties": {
111111
"environmentId": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.ContainerApps/environments/<ENVIRONMENT_NAME>",
112+
"poolManagementType": "Dynamic",
112113
"containerType": "CustomContainer",
113114
"scaleConfiguration": {
114115
"maxConcurrentSessions": 10,
115116
"readySessionInstances": 5
116117
},
117118
"dynamicPoolConfiguration": {
118119
"executionType": "Timed",
119-
"cooldownPeriodInSeconds": 300
120+
"cooldownPeriodInSeconds": 600
120121
},
121122
"customContainerTemplate": {
122123
"containers": [
123124
{
124125
"image": "myregistry.azurecr.io/my-container-image:1.0",
126+
"name": "mycontainer",
125127
"resources": {
126-
"cpu": 1.0,
127-
"memory": "2.0Gi"
128+
"cpu": 0.25,
129+
"memory": "0.5Gi"
128130
},
131+
"command": [
132+
"/bin/sh"
133+
],
134+
"args": [
135+
"-c",
136+
"while true; do echo hello; sleep 10;done"
137+
],
129138
"env": [
130139
{
131140
"name": "key1",
@@ -135,17 +144,15 @@ Before you send the request, replace the placeholders between the `<>` brackets
135144
"name": "key2",
136145
"value": "value2"
137146
}
138-
],
139-
"command": ["/bin/sh"],
140-
"args": ["-c", "while true; do echo hello; sleep 10; done"]
147+
]
141148
}
142149
],
143150
"ingress": {
144151
"targetPort": 80
145152
}
146153
},
147154
"sessionNetworkConfiguration": {
148-
"status": "EgressDisabled"
155+
"status": "EgressEnabled"
149156
}
150157
}
151158
}
@@ -158,17 +165,19 @@ This template creates a session pool with the following settings:
158165
| `name` | `my-session-pool` | The name of the session pool. |
159166
| `location` | `westus2` | The location of the session pool. |
160167
| `environmentId` | `/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.ContainerApps/environments/<ENVIRONMENT_NAME>` | The resource ID of the container app's environment. |
168+
| `poolManagementType` | `Dynamic` | Must be `Dynamic` for custom container sessions. |
161169
| `containerType` | `CustomContainer` | The container type of the session pool. Must be `CustomContainer` for custom container sessions. |
162170
| `scaleConfiguration.maxConcurrentSessions` | `10` | The maximum number of sessions that can be allocated at the same time. |
163171
| `scaleConfiguration.readySessionInstances` | `5` | The target number of sessions that are ready in the session pool all the time. Increase this number if sessions are allocated faster than the pool is being replenished. |
164172
| `dynamicPoolConfiguration.executionType` | `Timed` | The type of execution for the session pool. Must be `Timed` for custom container sessions. |
165-
| `dynamicPoolConfiguration.cooldownPeriodInSeconds` | `300` | The number of seconds that a session can be idle before the session is terminated. The idle period is reset each time the session's API is called. Value must be between `300` and `3600`. |
166-
| `customContainerTemplate.containers[0]` | `myregistry.azurecr.io/my-container-image:1.0` | The container image to use for the session pool. |
167-
| `customContainerTemplate.containers[0].resources.cpu` | `1.0` | The required CPU in cores. |
168-
| `customContainerTemplate.containers[0].resources.memory` | `2.0Gi` | The required memory. |
169-
| `customContainerTemplate.containers[0].env` | `{"key1": "value1", "key2": "value2"}` | The environment variables to set in the container. |
173+
| `dynamicPoolConfiguration.cooldownPeriodInSeconds` | `600` | The number of seconds that a session can be idle before the session is terminated. The idle period is reset each time the session's API is called. Value must be between `300` and `3600`. |
174+
| `customContainerTemplate.containers[0].image` | `myregistry.azurecr.io/my-container-image:1.0` | The container image to use for the session pool. |
175+
| `customContainerTemplate.containers[0].name` | `mycontainer` | The name of the container. |
176+
| `customContainerTemplate.containers[0].resources.cpu` | `0.25` | The required CPU in cores. |
177+
| `customContainerTemplate.containers[0].resources.memory` | `0.5Gi` | The required memory. |
178+
| `customContainerTemplate.containers[0].env` | Array of name-value pairs | The environment variables to set in the container. |
170179
| `customContainerTemplate.containers[0].command` | `["/bin/sh"]` | The command to run in the container. |
171-
| `customContainerTemplate.containers[0].args` | `["-c", "while true; do echo hello; sleep 10; done"]` | The arguments to pass to the command. |
180+
| `customContainerTemplate.containers[0].args` | `["-c", "while true; do echo hello; sleep 10;done"]` | The arguments to pass to the command. |
172181
| `customContainerTemplate.containers[0].ingress.targetPort` | `80` | The session port used for ingress traffic. |
173182
| `sessionNetworkConfiguration.status` | `EgressDisabled` | Designates whether outbound network traffic is allowed from the session. Valid values are `EgressDisabled` (default) and `EgressEnabled`. |
174183

0 commit comments

Comments
 (0)