Skip to content

Commit

Permalink
Add property for tcp apps (#20193)
Browse files Browse the repository at this point in the history
* Add property for tcp apps

* Add scale

* Fix

* Fix
  • Loading branch information
zhenqxuMSFT authored Aug 18, 2022
1 parent 903da55 commit 2b61c76
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
}
},
"HttpScaleRule": {
"description": "Container App container Custom scaling rule.",
"description": "Container App container Http scaling rule.",
"type": "object",
"properties": {
"metadata": {
Expand All @@ -354,6 +354,29 @@
}
}
},
"TcpScaleRule": {
"description": "Container App container Tcp scaling rule.",
"type": "object",
"properties": {
"metadata": {
"description": "Metadata properties to describe tcp scale rule.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"auth": {
"description": "Authentication secrets for the tcp scale rule.",
"type": "array",
"items": {
"$ref": "#/definitions/ScaleRuleAuth"
},
"x-ms-identifiers": [
"triggerParameter"
]
}
}
},
"QueueScaleRule": {
"description": "Container App container Azure Queue based scaling rule.",
"type": "object",
Expand Down Expand Up @@ -424,6 +447,10 @@
"http": {
"$ref": "#/definitions/HttpScaleRule",
"description": "HTTP requests based scaling."
},
"tcp": {
"$ref": "#/definitions/TcpScaleRule",
"description": "Tcp requests based scaling."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
"x-ms-examples": {
"Create or Update Container App": {
"$ref": "./examples/ContainerApps_CreateOrUpdate.json"
},
"Create or Update Tcp App": {
"$ref": "./examples/ContainerApps_TcpApp_CreateOrUpdate.json"
}
},
"x-ms-long-running-operation": true
Expand Down Expand Up @@ -640,12 +643,18 @@
"description": "Target Port in containers for traffic from ingress",
"type": "integer"
},
"exposedPort": {
"format": "int32",
"description": "Exposed Port in containers for TCP traffic from ingress",
"type": "integer"
},
"transport": {
"description": "Ingress transport protocol",
"enum": [
"auto",
"http",
"http2"
"http2",
"tcp"
],
"type": "string",
"x-ms-enum": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
{
"parameters": {
"subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
"resourceGroupName": "rg",
"containerAppName": "testcontainerAppTcp",
"api-version": "2022-06-01-preview",
"containerAppEnvelope": {
"location": "East US",
"properties": {
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"configuration": {
"ingress": {
"external": true,
"targetPort": 3000,
"exposedPort": 4000,
"transport": "tcp",
"traffic": [
{
"weight": 100,
"revisionName": "testcontainerAppTcp-ab1234"
}
]
}
},
"template": {
"containers": [
{
"image": "repo/testcontainerAppTcp:v1",
"name": "testcontainerAppTcp",
"probes": [
{
"type": "Liveness",
"tcpSocket": {
"port": 8080
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"scale": {
"minReplicas": 1,
"maxReplicas": 5,
"rules": [
{
"name": "tcpscalingrule",
"tcp": {
"metadata": {
"concurrentConnections": "50"
}
}
}
]
}
}
}
}
},
"responses": {
"200": {
"headers": {},
"body": {
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerAppTcp",
"name": "testcontainerAppTcp",
"type": "Microsoft.App/containerApps",
"location": "East US",
"properties": {
"provisioningState": "Succeeded",
"managedEnvironmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"latestRevisionFqdn": "testcontainerAppTcp-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io",
"configuration": {
"ingress": {
"fqdn": "testcontainerAppTcp.demokube-t24clv0g.eastus.containerApps.k4apps.io",
"external": true,
"targetPort": 3000,
"exposedPort": 4000,
"transport": "tcp",
"traffic": [
{
"weight": 80,
"revisionName": "testcontainerAppTcp-ab1234"
},
{
"weight": 20,
"revisionName": "testcontainerAppTcp-ab4321"
}
]
}
},
"template": {
"containers": [
{
"image": "repo/testcontainerAppTcp:v4",
"name": "testcontainerAppTcp",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"probes": [
{
"type": "Liveness",
"tcpSocket": {
"port": 8080
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"scale": {
"minReplicas": 1,
"maxReplicas": 5,
"rules": [
{
"name": "tcpscalingrule",
"tcp": {
"metadata": {
"concurrentConnections": "50"
}
}
}
]
}
}
}
}
},
"201": {
"headers": {},
"body": {
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerAppTcp",
"name": "testcontainerAppTcp",
"type": "Microsoft.App/containerApps",
"location": "East US",
"properties": {
"provisioningState": "InProgress",
"managedEnvironmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"latestRevisionFqdn": "testcontainerAppTcp-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io",
"configuration": {
"ingress": {
"fqdn": "testcontainerAppTcp.demokube-t24clv0g.eastus.containerApps.k4apps.io",
"external": true,
"targetPort": 3000,
"exposedPort": 4000,
"transport": "tcp",
"traffic": [
{
"weight": 80,
"revisionName": "testcontainerAppTcp-ab1234"
},
{
"weight": 20,
"revisionName": "testcontainerAppTcp-ab4321"
}
]
}
},
"template": {
"containers": [
{
"image": "repo/testcontainerAppTcp:v4",
"name": "testcontainerAppTcp",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"probes": [
{
"type": "Liveness",
"tcpSocket": {
"port": 8080
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"scale": {
"minReplicas": 1,
"maxReplicas": 5,
"rules": [
{
"name": "tcpscalingrule",
"tcp": {
"metadata": {
"concurrentConnections": "50"
}
}
}
]
}
}
}
}
}
}
}

0 comments on commit 2b61c76

Please sign in to comment.