# REST Resource: namespaces.workerpools

- [Resource: WorkerPool](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPool)
  - [JSON representation](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPool.SCHEMA_REPRESENTATION)
- [WorkerPoolSpec](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolSpec)
  - [JSON representation](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolSpec.SCHEMA_REPRESENTATION)
- [InstanceSplit](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#InstanceSplit)
  - [JSON representation](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#InstanceSplit.SCHEMA_REPRESENTATION)
- [WorkerPoolStatus](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolStatus)
  - [JSON representation](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolStatus.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#METHODS_SUMMARY)

## Resource: WorkerPool

WorkerPool acts as a top-level container that manages a set instance splits among a set of Revisions and a template for creating new Revisions.

| JSON representation |
|---|
| ``` { "apiVersion": string, "kind": string, "metadata": { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/ObjectMeta`) }, "spec": { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolSpec`) }, "status": { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolStatus`) } } ``` |

| Fields ||
|---|---|
| `apiVersion` | `string` The API version for this call. It must be "run.googleapis.com/v1". |
| `kind` | `string` The kind of resource. It must be "WorkerPool". |
| `metadata` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/ObjectMeta`)`` Metadata associated with this WorkerPool, including name, namespace, labels, and annotations. In Cloud Run, annotations with 'run.googleapis.com/' and 'autoscaling.knative.dev' are restricted, and the accepted annotations will be different depending on the resource type. The following Cloud Run-specific annotations are accepted in WorkerPool.metadata.annotations. - `run.googleapis.com/binary-authorization-breakglass` - `run.googleapis.com/binary-authorization` - `run.googleapis.com/client-name` - `run.googleapis.com/description` |
| `spec` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolSpec`)`` Holds the desired state of the WorkerPool (from the client). |
| `status` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#WorkerPoolStatus`)`` Communicates the system-controlled state of the WorkerPool. |

## WorkerPoolSpec

WorkerPoolSpec holds the desired state of the WorkerPool's template and instance splits.

| JSON representation |
|---|
| ``` { "template": { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/RevisionTemplate`) }, "instanceSplits": [ { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#InstanceSplit`) } ] } ``` |

| Fields ||
|---|---|
| `template` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/RevisionTemplate`)`` Holds the latest specification for the Revision to be stamped out. |
| `instanceSplits[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#InstanceSplit`)`` Specifies how to distribute instances over a collection of Revisions. |

## InstanceSplit

Holds a single instance split entry for the Worker. Allocations can be done to a specific Revision name, or pointing to the latest Ready Revision.

| JSON representation |
|---|
| ``` { "percent": integer, // Union field `target` can be only one of the following: "revisionName": string, "latestRevision": boolean // End of list of possible types for union field `target`. } ``` |

| Fields ||
|---|---|
| `percent` | `integer` Optional. Specifies percent of the instance split to this Revision. This defaults to zero if unspecified. |
| Union field `target`. The target of this instance split. `target` can be only one of the following: ||
| `revisionName` | `string` Revision to which to assign this portion of instances. |
| `latestRevision` | `boolean` Uses the "status.latestReadyRevisionName" to determine the instance split target. When it changes, workloads will automatically migrate from the prior "latest ready" revision to the new one. |

## WorkerPoolStatus

The current state of the WorkerPool. Output only.

| JSON representation |
|---|
| ``` { "observedGeneration": integer, "conditions": [ { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/Condition`) } ], "latestReadyRevisionName": string, "latestCreatedRevisionName": string, "instanceSplits": [ { object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#InstanceSplit`) } ] } ``` |

| Fields ||
|---|---|
| `observedGeneration` | `integer` Returns the generation last seen by the system. Clients polling for completed reconciliation should poll until observedGeneration = metadata.generation and the Ready condition's status is True or False. |
| `conditions[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/Condition`)`` Conditions communicate information about ongoing/complete reconciliation processes that bring the `spec` inline with the observed state of the world. - `Ready`: `True` when all underlying resources are ready. |
| `latestReadyRevisionName` | `string` Name of the latest Revision from this WorkerPool's template that has had its `Ready` condition become `True`. |
| `latestCreatedRevisionName` | `string` Name of the last revision that was created from this WorkerPool's template. It might not be ready yet, for that use LatestReadyRevisionName. |
| `instanceSplits[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools#InstanceSplit`)`` Holds the configured workload distribution. These entries will always contain RevisionName references. When ConfigurationName appears in the spec, this will hold the LatestReadyRevisionName that we last observed. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools/create` | Creates a new WorkerPool. |
| ### `https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools/delete` | Deletes the provided worker pool. |
| ### `https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools/get` | Gets information about a worker pool. |
| ### `https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools/list` | Lists worker pools for the given project and region. |
| ### `https://docs.cloud.google.com/run/docs/reference/rest/v1/namespaces.workerpools/replaceWorkerPool` | Replaces a worker pool. |