> ## Documentation Index
> Fetch the complete documentation index at: https://datum-4926dda5-docs-api-reference-demo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# WorkloadDeployment

> WorkloadDeployment is the Schema for the workloaddeployments API.

<Note>
  API resource reference for **WorkloadDeployment**, part of the [Compute service](/api/compute/overview). To create or change one, see [Changing resources](/datumctl/resources/changing); to inspect, see [Reading resources](/datumctl/resources/reading).
</Note>

<Warning>
  This resource is part of the `v1alpha1` API and is subject to change. Fields and behavior may change in future releases.
</Warning>

## Identity

|         |                         |
| ------- | ----------------------- |
| Group   | `compute.datumapis.com` |
| Version | `v1alpha1`              |
| Kind    | `WorkloadDeployment`    |
| Scope   | Project                 |

## Overview

A `WorkloadDeployment` represents a single placement of a workload scheduled to a specific location, such as a city. Each deployment belongs to a parent workload (referenced by `spec.workloadRef`) and corresponds to one of the workload's placements (`spec.placementName`). It defines how many instances run through its scale settings and what each instance looks like through its instance template.

You typically do not create `WorkloadDeployment` resources directly — they are produced when a workload is scheduled across its placements. Read them to inspect where a workload has been deployed and how many instances are currently running and ready in a given location.

## Spec fields

| Field                                         | Type      | Required | Description                                                                                               |
| --------------------------------------------- | --------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `spec.cityCode`                               | string    | Yes      | The location target for the deployment; deployments can be scheduled in ways other than just a city code. |
| `spec.placementName`                          | string    | Yes      | The placement in the workload that is driving this deployment.                                            |
| `spec.workloadRef`                            | Object    | Yes      | The workload that this deployment belongs to.                                                             |
| `spec.workloadRef.name`                       | string    | Yes      | The name of the workload.                                                                                 |
| `spec.workloadRef.uid`                        | string    | Yes      | UID of the workload.                                                                                      |
| `spec.scaleSettings`                          | Object    | Yes      | Scale settings such as minimum and maximum replica counts.                                                |
| `spec.scaleSettings.instanceManagementPolicy` | string    | Yes      | Controls how instances are managed during scale up and down, as well as during maintenance events.        |
| `spec.scaleSettings.minReplicas`              | integer   | Yes      | The minimum number of replicas.                                                                           |
| `spec.scaleSettings.maxReplicas`              | integer   | No       | The maximum number of replicas.                                                                           |
| `spec.scaleSettings.metrics`                  | \[]Object | No       | A list of metrics that determine scaling behavior, such as external metrics.                              |
| `spec.template`                               | Object    | Yes      | Defines settings for each instance.                                                                       |
| `spec.template.spec`                          | Object    | Yes      | Describes the desired configuration of an instance (runtime, network interfaces, volumes).                |
| `spec.template.metadata`                      | Object    | No       | Metadata of the instances created from this template.                                                     |

## Status fields (read-only)

| Field                    | Type      | Description                                                                                              |
| ------------------------ | --------- | -------------------------------------------------------------------------------------------------------- |
| `status.conditions`      | \[]Object | Observations of the deployment's current state. Known condition types are `Available` and `Progressing`. |
| `status.location`        | Object    | The location the deployment has been scheduled to.                                                       |
| `status.desiredReplicas` | integer   | The desired number of instances.                                                                         |
| `status.replicas`        | integer   | The number of instances created.                                                                         |
| `status.currentReplicas` | integer   | The number of instances that have the latest workload settings applied.                                  |
| `status.readyReplicas`   | integer   | The number of instances that are ready.                                                                  |

## Usage

```yaml theme={null}
apiVersion: compute.datumapis.com/v1alpha1
kind: WorkloadDeployment
metadata:
  name: web-us-central
spec:
  cityCode: DFW
  placementName: us-central
  workloadRef:
    name: web
    uid: 4c8f2e1a-9b3d-4f7a-8c21-1e5b7a9d0c3f
  scaleSettings:
    instanceManagementPolicy: RollingUpdate
    minReplicas: 1
    maxReplicas: 3
  template:
    spec:
      runtime: {}
      networkInterfaces:
        - {}
```

```bash theme={null}
datumctl apply -f workloaddeployment.yaml --project my-project
datumctl get workloaddeployments --project my-project
datumctl describe workloaddeployment web-us-central --project my-project
```

<Tip>
  Run `datumctl explain workloaddeployments --recursive` to see the full, live field tree for this resource.
</Tip>
