# CapacityReservation

Source: /reference/capacityreservations/

An existing cloud capacity reservation that InferenceCluster node pools can reference by name. Modelplane doesn't create or modify the reservation; it only directs node pools to consume it.

Apply instances as `apiVersion: modelplane.ai/v1alpha1`, `kind: CapacityReservation`.

[Concept guide: Register a Cluster](/platform/inference-cluster/index.md)

## Example

```yaml
apiVersion: modelplane.ai/v1alpha1
kind: CapacityReservation
metadata:
  name: a3-mega-calendar
spec:
  provider: GKE
  gke:
    zone: us-central1-a
    name: a3-mega-calendar
```

## Definition

The CompositeResourceDefinition this reference is generated from, with the complete OpenAPI schema, validation rules, and defaults:

```yaml
apiVersion: apiextensions.crossplane.io/v2
kind: CompositeResourceDefinition
metadata:
  name: capacityreservations.modelplane.ai
spec:
  group: modelplane.ai
  names:
    categories: [crossplane, modelplane, platform]
    kind: CapacityReservation
    plural: capacityreservations
  scope: Cluster
  versions:
  - name: v1alpha1
    served: true
    referenceable: true
    additionalPrinterColumns:
    - name: PROVIDER
      type: string
      jsonPath: .spec.provider
    schema:
      openAPIV3Schema:
        type: object
        description: >-
          An existing cloud capacity reservation that InferenceCluster node
          pools can reference by name. Modelplane doesn't create or modify the
          reservation; it only directs node pools to consume it.
        required: [spec]
        properties:
          spec:
            type: object
            required: [provider]
            x-kubernetes-validations:
            - rule: "self.provider != 'GKE' || has(self.gke)"
              message: spec.gke is required when spec.provider is GKE.
            - rule: "self.provider != 'EKS' || has(self.eks)"
              message: spec.eks is required when spec.provider is EKS.
            properties:
              provider:
                type: string
                description: >-
                  The cloud the reservation belongs to. A node pool can only
                  reference a reservation whose provider matches its cluster's
                  source.
                enum: [GKE, EKS]
              gke:
                type: object
                description: >-
                  A Compute Engine reservation, consumed as a specific
                  reservation. Any reservation type works, including future
                  reservations in calendar mode once their reservation period
                  starts. Required when provider is GKE.
                required: [zone, name]
                properties:
                  zone:
                    type: string
                    description: >-
                      Zone the reservation is in (e.g. us-central1-a). A node
                      pool backed by the reservation must be restricted to
                      exactly this zone.
                    minLength: 1
                    maxLength: 63
                  name:
                    type: string
                    description: Name of the reservation.
                    pattern: '^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$'
                    maxLength: 63
                  project:
                    type: string
                    description: >-
                      Project that owns the reservation, for a reservation
                      shared from another project. The reservation must be
                      shared with the cluster's project, and the cluster
                      project's GKE service agent must be allowed to list
                      reservations in this project. Omit for a reservation
                      in the cluster's own project.
                    pattern: '^[a-z][-a-z0-9]{4,28}[a-z0-9]$'
                    maxLength: 30
              eks:
                type: object
                description: >-
                  An EC2 Capacity Reservation. Required when provider is EKS.
                required: [region, type, id]
                properties:
                  region:
                    type: string
                    description: AWS region the reservation is in (e.g. us-east-2).
                    minLength: 1
                    maxLength: 32
                  type:
                    type: string
                    description: >-
                      The kind of Capacity Reservation. CapacityBlock is a
                      Capacity Block for ML. OnDemand is an On-Demand
                      Capacity Reservation.
                    enum: [CapacityBlock, OnDemand]
                  id:
                    type: string
                    description: >-
                      ID of the Capacity Reservation (e.g.
                      cr-0123456789abcdef0). Purchasing a Capacity Block
                      yields this ID.
                    pattern: '^cr-[0-9a-f]+$'
                    minLength: 4
                    maxLength: 64
          status:
            type: object
            properties:
              conditions:
                type: array
                items:
                  type: object
```
