> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

The CapacityQuota CustomResourceDefinition (CRD) limits the amount of resources
that can be provisioned for specific subsets of nodes that you target by using label selectors. For more information about how CapacityQuotas work, see [Configure granular resource limits](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/configure-capacity-quotas.md.txt).

```yaml
apiVersion: autoscaling.x-k8s.io/v1beta1
kind: CapacityQuota
metadata:
  name: capacity-quota
spec:
  selector:
    matchLabels:
      cloud.google.com/compute-class: my-class
    matchExpressions:
      - key: cloud.google.com/machine-family
        operator: In
        values:
          - c2
          - c3
          - c3d
  limits:
    resources:
      cpu: 64
      memory: 128Gi
status:
  observedGeneration: 1
  conditions:
  - lastTransitionTime: "2026-07-27T10:00:00Z"
    message: "CapacityQuota is valid"
    reason: "Valid"
    status: "True"
    type: "cluster-autoscaler.kubernetes.io/valid"
  used:
    resources:
      cpu: "32"
      memory: 128Gi
```

## CapacityQuota specification

```yaml
spec:
  limits: object (limits)
  selector: object (selector)
```

| Fields ||
|---|---|
| `spec.limits` *required* | `object (limits)` This object defines resource limits for the matched nodes. |
| `spec.selector` *optional* | `object (selector)` Label selectors to target subsets of nodes. If you omit this field or you don't specify a value, then the CapacityQuota matches all of the nodes in the cluster. |

### limits

`limits` object defines the resource limits of a CapacityQuota.

```yaml
limits:
  resources:
    string: string
```

| Fields ||
|---|---|
| `resources` *required* | `map (string: string)` The \`resources\` map define the resource limits of this quota. Map keys are resource names and map values are strings in the [resource.Quantity](https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity) format. The following resource names are supported: - `cpu`: limits for CPU resources. - `memory`: limits for memory resources. - `nodes`: limits for the number of nodes. - `nvidia.com/gpu`: limits for the number of NVIDIA GPUs. - `google.com/tpu`: limits for the number of TPUs. All resource quantities must be integer values that are greater than `0`. You can specify binary and decimal values if those values can be converted to integers. Milli units (`m`) aren't supported, even if the milli unit represents an integer value. Examples of valid resource quantities include `"32Gi"`, `"2k"`, and `"10.0"`. Examples of invalid quantities include `"1000m"`, `"3.67Gi"`, and `"0.3"`. |

### selector

This is a standard Kubernetes [LabelSelector](https://kubernetes.io/docs/reference/kubernetes-api/definitions/label-selector-v1-meta/)
object.

```yaml
matchExpressions:
  - object (matchExpressions)
matchLabels:
  string: string
```

| Fields ||
|---|---|
| `matchExpressions[]` *optional* | `object (matchExpressions)` A list of label selector requirements. The requirements are ANDed. |
| `matchLabels` *optional* | `map (string: string)` A map of key-value pairs. A single entry in the \`matchLabels\` map is equivalent to an element of \`matchExpressions\` field, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. |

### matchExpressions

This is a standard Kubernetes [LabelSelectorRequirement](https://kubernetes.io/docs/reference/kubernetes-api/definitions/label-selector-requirement-v1-meta/#label-selector-requirement) object.

```yaml
key: string
operator: string
values:
  - string
```

| Fields ||
|---|---|
| `key` *required* | `string` The label key that the selector applies to. |
| `operator` *required* | `string` This represents a key's relationship to a set of values. Valid operators are `In`, `NotIn`, `Exists` and `DoesNotExist`. |
| `values` *optional* | `array (string)` This is an array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch. |

## status

The `status` object indicates the observed state of the
CapacityQuota resource.

```yaml
conditions:
  - object (Condition)
observedGeneration: integer
used: object (used)
```

| Fields ||
|---|---|
| `conditions[]` | `object (Condition)` The \`conditions\` array provide a standard mechanism for reporting the quota's state. <br /> Cluster Autoscaler manages the `cluster-autoscaler.kubernetes.io/valid` condition, and will enforce the quota only if the status of the condition is `True`. |
| `observedGeneration` | `integer` The \`observedGeneration\` represents the last \`.metadata.generation\` observed by the controller. |
| `used` | `object (used)` The \`used\` object shows the current usage of the quota. |

### used

The `used` object shows the current usage of the quota.

```yaml
resources:
  string: string
```

| Fields ||
|---|---|
| `resources` | `map (string: string)` The \`resources\` map shows the current usage of the resources defined in the quota limits. |