Skip to content

Commit

Permalink
add event trigger for Container Jobs 2023-04-01-preview (#23724)
Browse files Browse the repository at this point in the history
* add event trigger for Container Jobs 2023-04-01-preview

* prettier and avocado fix

---------

Co-authored-by: Taher Darolywala <[email protected]>
  • Loading branch information
tdaroly and Taher Darolywala authored Apr 26, 2023
1 parent 8a49d04 commit f8b4b9a
Show file tree
Hide file tree
Showing 2 changed files with 240 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
"x-ms-examples": {
"Create or Update Container Apps Job": {
"$ref": "./examples/Job_CreateorUpdate.json"
},
"Create or Update Container Apps Job With Event Driver Trigger": {
"$ref": "./examples/Job_CreateorUpdate_EventTrigger.json"
}
},
"x-ms-long-running-operation": true,
Expand Down Expand Up @@ -706,6 +709,21 @@
}
}
},
"eventTriggerConfig": {
"type": "object",
"description": "Manual trigger configuration for a single execution job. Properties replicaCompletionCount and parallelism would be set to 1 by default",
"properties": {
"replicaCompletionCount": {
"$ref": "#/definitions/ReplicaCompletionCount"
},
"parallelism": {
"$ref": "#/definitions/Parallelism"
},
"scale": {
"$ref": "./CommonDefinitions.json#/definitions/Scale"
}
}
},
"registries": {
"description": "Collection of private container registry credentials used by a Container apps job",
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
{
"parameters": {
"subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
"resourceGroupName": "rg",
"jobName": "testcontainerAppsJob0",
"api-version": "2023-04-01-preview",
"JobEnvelope": {
"location": "East US",
"properties": {
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"configuration": {
"replicaTimeout": 10,
"replicaRetryLimit": 10,
"eventTriggerConfig": {
"replicaCompletionCount": 1,
"parallelism": 4,
"scale": {
"minReplicas": 1,
"maxReplicas": 5,
"rules": [
{
"name": "httpscalingrule",
"custom": {
"type": "http",
"metadata": {
"concurrentRequests": "50"
}
}
}
]
}
},
"triggerType": "Event"
},
"template": {
"containers": [
{
"image": "repo/testcontainerAppsJob0:v1",
"name": "testcontainerAppsJob0",
"probes": [
{
"type": "Liveness",
"httpGet": {
"path": "/health",
"port": 8080,
"httpHeaders": [
{
"name": "Custom-Header",
"value": "Awesome"
}
]
},
"initialDelaySeconds": 5,
"periodSeconds": 3
}
]
}
],
"initContainers": [
{
"image": "repo/testcontainerAppsJob0:v4",
"name": "testinitcontainerAppsJob0",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
]
}
}
}
},
"responses": {
"200": {
"headers": {},
"body": {
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0",
"name": "testcontainerAppsJob0",
"type": "Microsoft.App/jobs",
"location": "East US",
"properties": {
"provisioningState": "InProgress",
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"configuration": {
"replicaTimeout": 10,
"replicaRetryLimit": 10,
"manualTriggerConfig": {
"replicaCompletionCount": 1,
"parallelism": 4
},
"triggerType": "Manual"
},
"template": {
"containers": [
{
"image": "repo/testcontainerAppsJob0:v4",
"name": "testcontainerAppsJob0",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"probes": [
{
"type": "Liveness",
"httpGet": {
"path": "/health",
"port": 8080,
"httpHeaders": [
{
"name": "Custom-Header",
"value": "Awesome"
}
]
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"initContainers": [
{
"image": "repo/testcontainerAppsJob0:v4",
"name": "testinitcontainerAppsJob0",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
]
},
"eventStreamEndpoint": "testEndpoint"
}
}
},
"201": {
"headers": {
"Location": "location"
},
"body": {
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0",
"name": "testcontainerAppsJob0",
"type": "Microsoft.App/jobs",
"location": "East US",
"properties": {
"provisioningState": "InProgress",
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"configuration": {
"replicaTimeout": 10,
"replicaRetryLimit": 10,
"manualTriggerConfig": {
"replicaCompletionCount": 1,
"parallelism": 4
},
"triggerType": "Manual"
},
"template": {
"containers": [
{
"image": "repo/testcontainerAppsJob0:v4",
"name": "testcontainerAppsJob0",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"probes": [
{
"type": "Liveness",
"httpGet": {
"path": "/health",
"port": 8080,
"httpHeaders": [
{
"name": "Custom-Header",
"value": "Awesome"
}
]
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"initContainers": [
{
"image": "repo/testcontainerAppsJob0:v4",
"name": "testinitcontainerAppsJob0",
"resources": {
"cpu": 0.2,
"memory": "100Mi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
]
},
"eventStreamEndpoint": "testEndpoint"
}
}
}
}
}

0 comments on commit f8b4b9a

Please sign in to comment.