From f8b4b9a99a2daff90bfab23bd759ccc631423438 Mon Sep 17 00:00:00 2001 From: Taher Daroly <41846928+tdaroly@users.noreply.github.com> Date: Tue, 25 Apr 2023 19:03:01 -0500 Subject: [PATCH] add event trigger for Container Jobs 2023-04-01-preview (#23724) * add event trigger for Container Jobs 2023-04-01-preview * prettier and avocado fix --------- Co-authored-by: Taher Darolywala --- .../preview/2023-04-01-preview/Jobs.json | 18 ++ .../Job_CreateorUpdate_EventTrigger.json | 222 ++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/examples/Job_CreateorUpdate_EventTrigger.json diff --git a/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/Jobs.json b/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/Jobs.json index 102665a33ceb..1c56a01284f4 100644 --- a/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/Jobs.json +++ b/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/Jobs.json @@ -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, @@ -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", diff --git a/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/examples/Job_CreateorUpdate_EventTrigger.json b/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/examples/Job_CreateorUpdate_EventTrigger.json new file mode 100644 index 000000000000..dbc368f0970c --- /dev/null +++ b/specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/examples/Job_CreateorUpdate_EventTrigger.json @@ -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" + } + } + } + } +}