diff --git a/.gitignore b/.gitignore index 8655883e5..efbf7b661 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ /.gen /.vscode /.stamp -*~ \ No newline at end of file +*~ +*.swp +*.swo diff --git a/Makefile b/Makefile index b4b33bdb5..965fa9b78 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ STAMPDIR := .stamp COLOR := "\e[1;36m%s\e[0m\n" PROTO_ROOT := . -PROTO_FILES = $(shell find temporal -name "*.proto") +PROTO_FILES = $(shell find temporal -name "*.proto" -not -name "*.swp") PROTO_DIRS = $(sort $(dir $(PROTO_FILES))) PROTO_OUT := .gen PROTO_IMPORTS = \ diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 2f21bedcc..3f4bec76f 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -2488,6 +2488,51 @@ "tags": [ "WorkflowService" ] + }, + "post": { + "summary": "Creates a new Worker Deployment.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "CreateWorkerDeployment2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateWorkerDeploymentResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "The name of the Worker Deployment to create. If a Worker Deployment with\nthis name already exists, an error will be returned.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceCreateWorkerDeploymentBody" + } + } + ], + "tags": [ + "WorkflowService" + ] } }, "/api/v1/namespaces/{namespace}/worker-deployments/{deploymentName}/set-current-version": { @@ -6988,6 +7033,51 @@ "tags": [ "WorkflowService" ] + }, + "post": { + "summary": "Creates a new Worker Deployment.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "CreateWorkerDeployment", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateWorkerDeploymentResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "The name of the Worker Deployment to create. If a Worker Deployment with\nthis name already exists, an error will be returned.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceCreateWorkerDeploymentBody" + } + } + ], + "tags": [ + "WorkflowService" + ] } }, "/namespaces/{namespace}/worker-deployments/{deploymentName}/set-current-version": { @@ -9144,6 +9234,28 @@ } } }, + "WorkflowServiceCreateWorkerDeploymentBody": { + "type": "object", + "properties": { + "workerVersioningMode": { + "$ref": "#/definitions/v1WorkerVersioningMode", + "description": "Optional. Indicates the Worker Deployment should use a particular\nversioning strategy.\n\nIf empty, defaults to UNVERSIONED." + }, + "computeConfig": { + "$ref": "#/definitions/v1ComputeConfig", + "description": "Optional. Contains the new worker compute configuration for the Worker\nDeployment. Used as the default compute configuration for new Worker\nDeployment Versions created for this Worker Deployment." + }, + "identity": { + "type": "string", + "description": "Optional. The identity of the client who initiated this request." + }, + "requestId": { + "type": "string", + "description": "A unique identifier for this create request for idempotence. Typically UUIDv4." + } + }, + "description": "Creates a new WorkerDeployment." + }, "WorkflowServiceCreateWorkflowRuleBody": { "type": "object", "properties": { @@ -11848,6 +11960,66 @@ }, "description": "Used by the worker versioning APIs, represents an unordered set of one or more versions which are\nconsidered to be compatible with each other. Currently the versions are always worker build IDs." }, + "v1ComputeConfig": { + "type": "object", + "properties": { + "taskQueues": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1TaskQueueNameType" + }, + "description": "When a task matching any of these task queue name + type tuples is\nreceived by the Temporal Server and there are no active pollers to send\nthe task to, workers will be launched using the configuration\ninformation in the provider field." + }, + "provider": { + "$ref": "#/definitions/v1ComputeProvider", + "description": "Stores instructions for a worker control plane controller how to respond\nto worker lifeycle events." + }, + "scaler": { + "$ref": "#/definitions/v1ComputeScaler", + "description": "Informs a worker lifecycle controller *when* and *how often* to perform\ncertain worker lifecycle actions like starting a serverless worker." + } + }, + "description": "ComputeConfig stores configuration that helps a worker control plane\ncontroller understand *when* and *how* to respond to worker lifecycle\nevents." + }, + "v1ComputeProvider": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of the compute provider. This string is implementation-specific and\ncan be used by implementations to understand how to interpret the\ncontents of the provider_details field." + }, + "detailJson": { + "type": "string", + "title": "will be an unencrypted, JSON-encoded object of provider-specific\ninformation" + }, + "detailPayload": { + "$ref": "#/definitions/v1Payload", + "description": "will be an encrypted, encoded bytestring containing\nprovider-specific information. The implementation must understand\nhow to decrypt the payload." + }, + "nexusEndpoint": { + "type": "string", + "description": "Optional. If the compute provider is a Nexus service, this should point\nthere." + } + }, + "description": "ComputeProvider stores information used by a worker control plane controller\nto respond to worker lifecycle events. For example, when a Task is received\non a TaskQueue that has no active pollers, a serverless worker lifecycle\ncontroller might need to invoke an AWS Lambda Function that itself ends up\ncalling the SDK's worker.New() function." + }, + "v1ComputeScaler": { + "type": "object", + "properties": { + "minInstances": { + "type": "integer", + "format": "int32", + "description": "The lower limit for the number of Workers (in the WorkerDeployment) to\nwhich the ComputeScaler can scale down." + }, + "maxInstances": { + "type": "integer", + "format": "int32", + "description": "The upper limit for the number of Workers (in the WorkerDeployment) to\nwhich the ComputeScaler can scale up. Must be greater than or equal to\nmin_instances." + } + }, + "description": "ComputeScaler instructs the Temporal Service when to scale up or down the number of\nWorkers that comprise a WorkerDeployment." + }, "v1ConfigMetadata": { "type": "object", "properties": { @@ -12015,6 +12187,16 @@ } } }, + "v1CreateWorkerDeploymentResponse": { + "type": "object", + "properties": { + "conflictToken": { + "type": "string", + "format": "byte", + "description": "This value is returned so that it can be optionally passed to APIs that\nwrite to the WorkerDeployment state to ensure that the state did not\nchange between this API call and a future write." + } + } + }, "v1CreateWorkflowRuleResponse": { "type": "object", "properties": { @@ -16002,6 +16184,18 @@ "default": "TASK_QUEUE_KIND_UNSPECIFIED", "description": " - TASK_QUEUE_KIND_UNSPECIFIED: Tasks from any non workflow task may be unspecified.\n\nTask queue kind is used to differentiate whether a workflow task queue is sticky or \nnormal. If a task is not a workflow task, Task queue kind will sometimes be \nunspecified.\n - TASK_QUEUE_KIND_NORMAL: Tasks from a normal workflow task queue always include complete workflow history\n\nThe task queue specified by the user is always a normal task queue. There can be as many\nworkers as desired for a single normal task queue. All those workers may pick up tasks from\nthat queue.\n - TASK_QUEUE_KIND_STICKY: A sticky queue only includes new history since the last workflow task, and they are\nper-worker.\n\nSticky queues are created dynamically by each worker during their start up. They only exist\nfor the lifetime of the worker process. Tasks in a sticky task queue are only available to\nthe worker that created the sticky queue.\n\nSticky queues are only for workflow tasks. There are no sticky task queues for activities." }, + "v1TaskQueueNameType": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/v1TaskQueueType" + } + }, + "description": "Uniquely identifies a combination of task queue name and type." + }, "v1TaskQueueReachability": { "type": "object", "properties": { @@ -16672,6 +16866,10 @@ "routingConfigUpdateState": { "$ref": "#/definitions/v1RoutingConfigUpdateState", "description": "Indicates whether the routing_config has been fully propagated to all\nrelevant task queues and their partitions." + }, + "computeConfig": { + "$ref": "#/definitions/v1ComputeConfig", + "description": "Contains information used by worker control plane controllers to handle\nscale events." } }, "description": "A Worker Deployment (Deployment, for short) represents all workers serving \na shared set of Task Queues. Typically, a Deployment represents one service or \napplication.\nA Deployment contains multiple Deployment Versions, each representing a different \nversion of workers. (see documentation of WorkerDeploymentVersionInfo)\nDeployment records are created in Temporal server automatically when their\nfirst poller arrives to the server.\nExperimental. Worker Deployments are experimental and might significantly change in the future." @@ -16780,6 +16978,10 @@ "metadata": { "$ref": "#/definitions/v1VersionMetadata", "description": "Arbitrary user-provided metadata attached to this version." + }, + "computeConfig": { + "$ref": "#/definitions/v1ComputeConfig", + "description": "Contains information used by worker control plane controllers to handle\nscale events." } }, "description": "A Worker Deployment Version (Version, for short) represents all workers of the same \ncode and config within a Deployment. Workers of the same Version are expected to \nbehave exactly the same so when executions move between them there are no \nnon-determinism issues.\nWorker Deployment Versions are created in Temporal server automatically when \ntheir first poller arrives to the server.\nExperimental. Worker Deployments are experimental and might significantly change in the future." diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index c220f6773..c95bbc977 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -2203,6 +2203,48 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + post: + tags: + - WorkflowService + description: |- + Creates a new Worker Deployment. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: CreateWorkerDeployment + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + The name of the Worker Deployment to create. If a Worker Deployment with + this name already exists, an error will be returned. + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' delete: tags: - WorkflowService @@ -6238,6 +6280,48 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + post: + tags: + - WorkflowService + description: |- + Creates a new Worker Deployment. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: CreateWorkerDeployment + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + The name of the Worker Deployment to create. If a Worker Deployment with + this name already exists, an error will be returned. + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' delete: tags: - WorkflowService @@ -9035,6 +9119,88 @@ components: description: |- Used by the worker versioning APIs, represents an unordered set of one or more versions which are considered to be compatible with each other. Currently the versions are always worker build IDs. + ComputeConfig: + type: object + properties: + taskQueues: + type: array + items: + $ref: '#/components/schemas/TaskQueueNameType' + description: |- + When a task matching any of these task queue name + type tuples is + received by the Temporal Server and there are no active pollers to send + the task to, workers will be launched using the configuration + information in the provider field. + provider: + allOf: + - $ref: '#/components/schemas/ComputeProvider' + description: |- + Stores instructions for a worker control plane controller how to respond + to worker lifeycle events. + scaler: + allOf: + - $ref: '#/components/schemas/ComputeScaler' + description: |- + Informs a worker lifecycle controller *when* and *how often* to perform + certain worker lifecycle actions like starting a serverless worker. + description: |- + ComputeConfig stores configuration that helps a worker control plane + controller understand *when* and *how* to respond to worker lifecycle + events. + ComputeProvider: + type: object + properties: + type: + type: string + description: |- + Type of the compute provider. This string is implementation-specific and + can be used by implementations to understand how to interpret the + contents of the provider_details field. + detailJson: + type: string + description: |- + will be an unencrypted, JSON-encoded object of provider-specific + information + (-- api-linter: core::0146::any=disabled + aip.dev/not-precedent: This needs to be extensible to + externally-written compute providers --) + detailPayload: + allOf: + - $ref: '#/components/schemas/Payload' + description: |- + will be an encrypted, encoded bytestring containing + provider-specific information. The implementation must understand + how to decrypt the payload. + nexusEndpoint: + type: string + description: |- + Optional. If the compute provider is a Nexus service, this should point + there. + description: |- + ComputeProvider stores information used by a worker control plane controller + to respond to worker lifecycle events. For example, when a Task is received + on a TaskQueue that has no active pollers, a serverless worker lifecycle + controller might need to invoke an AWS Lambda Function that itself ends up + calling the SDK's worker.New() function. + ComputeScaler: + type: object + properties: + minInstances: + type: integer + description: |- + The lower limit for the number of Workers (in the WorkerDeployment) to + which the ComputeScaler can scale down. + format: int32 + maxInstances: + type: integer + description: |- + The upper limit for the number of Workers (in the WorkerDeployment) to + which the ComputeScaler can scale up. Must be greater than or equal to + min_instances. + format: int32 + description: |- + ComputeScaler instructs the Temporal Service when to scale up or down the number of + Workers that comprise a WorkerDeployment. ConfigMetadata: type: object properties: @@ -9183,6 +9349,52 @@ components: conflictToken: type: string format: bytes + CreateWorkerDeploymentRequest: + type: object + properties: + namespace: + type: string + deploymentName: + type: string + description: |- + The name of the Worker Deployment to create. If a Worker Deployment with + this name already exists, an error will be returned. + workerVersioningMode: + enum: + - WORKER_VERSIONING_MODE_UNSPECIFIED + - WORKER_VERSIONING_MODE_UNVERSIONED + - WORKER_VERSIONING_MODE_VERSIONED + type: string + description: |- + Optional. Indicates the Worker Deployment should use a particular + versioning strategy. + + If empty, defaults to UNVERSIONED. + format: enum + computeConfig: + allOf: + - $ref: '#/components/schemas/ComputeConfig' + description: |- + Optional. Contains the new worker compute configuration for the Worker + Deployment. Used as the default compute configuration for new Worker + Deployment Versions created for this Worker Deployment. + identity: + type: string + description: Optional. The identity of the client who initiated this request. + requestId: + type: string + description: A unique identifier for this create request for idempotence. Typically UUIDv4. + description: Creates a new WorkerDeployment. + CreateWorkerDeploymentResponse: + type: object + properties: + conflictToken: + type: string + description: |- + This value is returned so that it can be optionally passed to APIs that + write to the WorkerDeployment state to ensure that the state did not + change between this API call and a future write. + format: bytes CreateWorkflowRuleRequest: type: object properties: @@ -14139,6 +14351,23 @@ components: type: number format: float description: If set, overrides the fairness weights for the corresponding fairness keys. + TaskQueueNameType: + type: object + properties: + name: + type: string + type: + enum: + - TASK_QUEUE_TYPE_UNSPECIFIED + - TASK_QUEUE_TYPE_WORKFLOW + - TASK_QUEUE_TYPE_ACTIVITY + - TASK_QUEUE_TYPE_NEXUS + type: string + format: enum + description: |- + Uniquely identifies a combination of task queue name and type. + (-- api-linter: core::0123::resource-annotation=disabled + aip.dev/not-precedent: this isn't a resource --) TaskQueueReachability: type: object properties: @@ -15206,6 +15435,12 @@ components: Indicates whether the routing_config has been fully propagated to all relevant task queues and their partitions. format: enum + computeConfig: + allOf: + - $ref: '#/components/schemas/ComputeConfig' + description: |- + Contains information used by worker control plane controllers to handle + scale events. description: "A Worker Deployment (Deployment, for short) represents all workers serving \n a shared set of Task Queues. Typically, a Deployment represents one service or \n application.\n A Deployment contains multiple Deployment Versions, each representing a different \n version of workers. (see documentation of WorkerDeploymentVersionInfo)\n Deployment records are created in Temporal server automatically when their\n first poller arrives to the server.\n Experimental. Worker Deployments are experimental and might significantly change in the future." WorkerDeploymentInfo_WorkerDeploymentVersionSummary: type: object @@ -15417,6 +15652,12 @@ components: allOf: - $ref: '#/components/schemas/VersionMetadata' description: Arbitrary user-provided metadata attached to this version. + computeConfig: + allOf: + - $ref: '#/components/schemas/ComputeConfig' + description: |- + Contains information used by worker control plane controllers to handle + scale events. description: "A Worker Deployment Version (Version, for short) represents all workers of the same \n code and config within a Deployment. Workers of the same Version are expected to \n behave exactly the same so when executions move between them there are no \n non-determinism issues.\n Worker Deployment Versions are created in Temporal server automatically when \n their first poller arrives to the server.\n Experimental. Worker Deployments are experimental and might significantly change in the future." WorkerDeploymentVersionInfo_VersionTaskQueueInfo: type: object diff --git a/temporal/api/common/v1/message.proto b/temporal/api/common/v1/message.proto index aa5b3f370..6cf468670 100644 --- a/temporal/api/common/v1/message.proto +++ b/temporal/api/common/v1/message.proto @@ -15,6 +15,7 @@ import "google/protobuf/empty.proto"; import "temporal/api/enums/v1/common.proto"; import "temporal/api/enums/v1/event_type.proto"; import "temporal/api/enums/v1/reset.proto"; +import "temporal/api/enums/v1/task_queue.proto"; message DataBlob { temporal.api.enums.v1.EncodingType encoding_type = 1; @@ -79,6 +80,14 @@ message ActivityType { string name = 1; } +// Uniquely identifies a combination of task queue name and type. +// (-- api-linter: core::0123::resource-annotation=disabled +// aip.dev/not-precedent: this isn't a resource --) +message TaskQueueNameType { + string name = 1; + temporal.api.enums.v1.TaskQueueType type = 2; +} + // How retries ought to be handled, usable by both workflows and activities message RetryPolicy { // Interval of the first retry. If retryBackoffCoefficient is 1.0 then it is used for all retries. diff --git a/temporal/api/compute/v1/config.proto b/temporal/api/compute/v1/config.proto new file mode 100644 index 000000000..0055defd0 --- /dev/null +++ b/temporal/api/compute/v1/config.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package temporal.api.compute.v1; + +option go_package = "go.temporal.io/api/compute/v1;compute"; +option java_package = "io.temporal.api.compute.v1"; +option java_multiple_files = true; +option java_outer_classname = "ConfigProto"; +option ruby_package = "Temporalio::Api::Compute::V1"; +option csharp_namespace = "Temporalio.Api.Compute.V1"; + +import "temporal/api/compute/v1/provider.proto"; +import "temporal/api/compute/v1/scaler.proto"; +import "temporal/api/common/v1/message.proto"; + +// ComputeConfig stores configuration that helps a worker control plane +// controller understand *when* and *how* to respond to worker lifecycle +// events. +message ComputeConfig { + // When a task matching any of these task queue name + type tuples is + // received by the Temporal Server and there are no active pollers to send + // the task to, workers will be launched using the configuration + // information in the provider field. + repeated temporal.api.common.v1.TaskQueueNameType task_queues = 1; + // Stores instructions for a worker control plane controller how to respond + // to worker lifeycle events. + temporal.api.compute.v1.ComputeProvider provider = 2; + // Informs a worker lifecycle controller *when* and *how often* to perform + // certain worker lifecycle actions like starting a serverless worker. + temporal.api.compute.v1.ComputeScaler scaler = 3; +} diff --git a/temporal/api/compute/v1/provider.proto b/temporal/api/compute/v1/provider.proto new file mode 100644 index 000000000..0ce446f6a --- /dev/null +++ b/temporal/api/compute/v1/provider.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package temporal.api.compute.v1; + +option go_package = "go.temporal.io/api/compute/v1;compute"; +option java_package = "io.temporal.api.compute.v1"; +option java_multiple_files = true; +option java_outer_classname = "ProviderProto"; +option ruby_package = "Temporalio::Api::Compute::V1"; +option csharp_namespace = "Temporalio.Api.Compute.V1"; + +import "temporal/api/common/v1/message.proto"; + +// ComputeProvider stores information used by a worker control plane controller +// to respond to worker lifecycle events. For example, when a Task is received +// on a TaskQueue that has no active pollers, a serverless worker lifecycle +// controller might need to invoke an AWS Lambda Function that itself ends up +// calling the SDK's worker.New() function. +message ComputeProvider { + // Type of the compute provider. This string is implementation-specific and + // can be used by implementations to understand how to interpret the + // contents of the provider_details field. + string type = 1; + // Contains provider-specific instructions and configuration. + oneof detail { + // will be an unencrypted, JSON-encoded object of provider-specific + // information + // (-- api-linter: core::0146::any=disabled + // aip.dev/not-precedent: This needs to be extensible to + // externally-written compute providers --) + string detail_json = 2; + // will be an encrypted, encoded bytestring containing + // provider-specific information. The implementation must understand + // how to decrypt the payload. + temporal.api.common.v1.Payload detail_payload = 3; + } + // Optional. If the compute provider is a Nexus service, this should point + // there. + string nexus_endpoint = 10; +} diff --git a/temporal/api/compute/v1/scaler.proto b/temporal/api/compute/v1/scaler.proto new file mode 100644 index 000000000..7fbb7da74 --- /dev/null +++ b/temporal/api/compute/v1/scaler.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package temporal.api.compute.v1; + +option go_package = "go.temporal.io/api/compute/v1;compute"; +option java_package = "io.temporal.api.compute.v1"; +option java_multiple_files = true; +option java_outer_classname = "ScalerProto"; +option ruby_package = "Temporalio::Api::Compute::V1"; +option csharp_namespace = "Temporalio.Api.Compute.V1"; + +// ComputeScaler instructs the Temporal Service when to scale up or down the number of +// Workers that comprise a WorkerDeployment. +message ComputeScaler { + // The lower limit for the number of Workers (in the WorkerDeployment) to + // which the ComputeScaler can scale down. + int32 min_instances = 1; + // The upper limit for the number of Workers (in the WorkerDeployment) to + // which the ComputeScaler can scale up. Must be greater than or equal to + // min_instances. + int32 max_instances = 2; +} diff --git a/temporal/api/deployment/v1/message.proto b/temporal/api/deployment/v1/message.proto index b4b7883dd..a42a1a50f 100644 --- a/temporal/api/deployment/v1/message.proto +++ b/temporal/api/deployment/v1/message.proto @@ -14,6 +14,7 @@ import "google/protobuf/timestamp.proto"; import "temporal/api/enums/v1/deployment.proto"; import "temporal/api/enums/v1/task_queue.proto"; import "temporal/api/common/v1/message.proto"; +import "temporal/api/compute/v1/config.proto"; // Worker Deployment options set in SDK that need to be sent to server in every poll. // Experimental. Worker Deployments are experimental and might significantly change in the future. @@ -158,6 +159,10 @@ message WorkerDeploymentVersionInfo { // Arbitrary user-provided metadata attached to this version. VersionMetadata metadata = 10; + + // Contains information used by worker control plane controllers to handle + // scale events. + temporal.api.compute.v1.ComputeConfig compute_config = 20; } // Information about workflow drainage to help the user determine when it is safe @@ -211,6 +216,10 @@ message WorkerDeploymentInfo { // relevant task queues and their partitions. temporal.api.enums.v1.RoutingConfigUpdateState routing_config_update_state = 7; + // Contains information used by worker control plane controllers to handle + // scale events. + temporal.api.compute.v1.ComputeConfig compute_config = 20; + message WorkerDeploymentVersionSummary { // Deprecated. Use `deployment_version`. string version = 1 [deprecated = true]; @@ -311,4 +320,4 @@ message InheritedAutoUpgradeInfo { temporal.api.deployment.v1.WorkerDeploymentVersion source_deployment_version = 1; // The revision number of the source deployment version of the parent/previous workflow. int64 source_deployment_revision_number = 2; -} \ No newline at end of file +} diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 4bf3272c6..b2f96fac2 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -25,6 +25,7 @@ import "temporal/api/common/v1/message.proto"; import "temporal/api/history/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; import "temporal/api/command/v1/message.proto"; +import "temporal/api/compute/v1/config.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/filter/v1/message.proto"; @@ -2317,6 +2318,37 @@ message SetWorkerDeploymentRampingVersionResponse { float previous_percentage = 3 [deprecated = true]; } +// Creates a new WorkerDeployment. +message CreateWorkerDeploymentRequest { + string namespace = 1; + // The name of the Worker Deployment to create. If a Worker Deployment with + // this name already exists, an error will be returned. + string deployment_name = 2; + + // Optional. Indicates the Worker Deployment should use a particular + // versioning strategy. + // + // If empty, defaults to UNVERSIONED. + temporal.api.enums.v1.WorkerVersioningMode worker_versioning_mode = 3; + + // Optional. Contains the new worker compute configuration for the Worker + // Deployment. Used as the default compute configuration for new Worker + // Deployment Versions created for this Worker Deployment. + temporal.api.compute.v1.ComputeConfig compute_config = 6; + + // Optional. The identity of the client who initiated this request. + string identity = 15; + // A unique identifier for this create request for idempotence. Typically UUIDv4. + string request_id = 16; +} + +message CreateWorkerDeploymentResponse { + // This value is returned so that it can be optionally passed to APIs that + // write to the WorkerDeployment state to ensure that the state did not + // change between this API call and a future write. + bytes conflict_token = 1; +} + message ListWorkerDeploymentsRequest { string namespace = 1; int32 page_size = 2; diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index c67a2717b..c53320728 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -966,6 +966,21 @@ service WorkflowService { }; } + // Creates a new Worker Deployment. + // + // Experimental. This API might significantly change or be removed in a + // future release. + rpc CreateWorkerDeployment (CreateWorkerDeploymentRequest) returns (CreateWorkerDeploymentResponse) { + option (google.api.http) = { + post: "/namespaces/{namespace}/worker-deployments/{deployment_name}" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/worker-deployments/{deployment_name}" + body: "*" + } + }; + } + // Updates the user-given metadata attached to a Worker Deployment Version. // Experimental. This API might significantly change or be removed in a future release. rpc UpdateWorkerDeploymentVersionMetadata (UpdateWorkerDeploymentVersionMetadataRequest) returns (UpdateWorkerDeploymentVersionMetadataResponse) {