> ## Documentation Index
> Fetch the complete documentation index at: https://autopilot.docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CRD Reference

> Full schemas for the RebalancePolicy, NodeScalingPolicy, and PodResizePolicy custom resources.

Autopilot is configured through Kubernetes custom resources in the `ops-ai.io/v1alpha1` API
group.

<Note>
  The `ops-ai.io` API group keeps its original name — renaming a CRD API group would break
  every existing resource on a cluster.
</Note>

## RebalancePolicy

API group: `ops-ai.io/v1alpha1` · Short name: `rbp`

```yaml theme={null}
apiVersion: ops-ai.io/v1alpha1
kind: RebalancePolicy
metadata:
  name: default
  namespace: production
spec:
  # Cron expression for rebalancing schedule
  schedule: "*/5 * * * *"

  thresholds:
    imbalanceScore: 0.3    # Minimum imbalance score (0-1) to trigger; default 0.3
    minUtilization: 0.2    # Minimum acceptable node utilization; default 0.2
    maxUtilization: 0.8    # Maximum acceptable node utilization; default 0.8

  # Namespaces to skip during rebalancing
  excludeNamespaces:
    - kube-system
    - monitoring

  # Pods matching these labels are never moved
  excludeLabels:
    app: stateful-db

  maxMovements: 50         # Maximum pod movements per cycle; default 50
  maxParallel: 5           # Maximum concurrent pod evictions; default 5
  dryRun: false            # Analyze only, do not execute; default false
  respectPDB: true         # Respect PodDisruptionBudgets; default true

status:
  lastRunTime: "2026-03-14T10:00:00Z"
  lastSuccessTime: "2026-03-14T10:00:00Z"
  conditions:
    - type: Ready
      status: "True"
  lastPlan:
    id: "plan-abc123"
    movementCount: 5
    scoreBefore: 0.45
    scoreAfter: 0.12
    executedAt: "2026-03-14T10:00:00Z"
    success: true
```

## NodeScalingPolicy

API group: `ops-ai.io/v1alpha1` · Short name: `nsp`

```yaml theme={null}
apiVersion: ops-ai.io/v1alpha1
kind: NodeScalingPolicy
metadata:
  name: workers
  namespace: production
spec:
  minNodes: 3              # default 3
  maxNodes: 100            # default 100

  scaleUpThreshold: 0.8    # Utilization threshold (0-1); default 0.8
  scaleDownThreshold: 0.4  # default 0.4

  cooldownPeriod: "10m"    # Minimum time between scaling actions; default 10m

  # Only consider nodes matching these labels
  nodeSelector:
    node-pool: workers

  nodePoolName: "workers"  # GKE node pool name to scale (NodePool mode)

  pendingPodThreshold: 5   # Pending pods before scale-up triggers; default 5

status:
  currentNodes: 5
  desiredNodes: 5
  lastScaleTime: "2026-03-14T09:30:00Z"
  lastScaleAction: "ScaleUp"
  conditions:
    - type: Ready
      status: "True"
```

For heterogeneous mode (per-pod machine type selection), see the example on the
[Node Scaling](/platform/node-scaling) page.

## PodResizePolicy

API group: `ops-ai.io/v1alpha1` · Short name: `prp`

```yaml theme={null}
apiVersion: ops-ai.io/v1alpha1
kind: PodResizePolicy
metadata:
  name: default
  namespace: production
spec:
  # Target utilization percentages (display-only; buffer is the active knob)
  targetUtilization:
    cpu: 70                # default 70
    memory: 80             # default 80

  minResources:            # Floor for recommendations
    cpu: 100m
    memory: 128Mi

  maxResources:            # Ceiling for recommendations
    cpu: "4"
    memory: 8Gi

  resizeMode: InPlace      # InPlace (KEP-1287, no restart) or Restart; default InPlace

  # Target pods by label selector
  selector:
    matchLabels:
      app: my-app

  excludeNamespaces:
    - kube-system

  recommendationBuffer: 15 # Percentage buffer above predicted usage; default 15
  historyDuration: "24h"   # How far back to look at usage history; default 24h

status:
  recommendationCount: 12
  lastEvaluationTime: "2026-03-14T10:00:00Z"
  totalResizes: 45
  conditions:
    - type: Ready
      status: "True"
```

**Notes on InPlace resize mode:**

* Requires Kubernetes 1.27+ with the `InPlacePodVerticalScaling` feature gate enabled (beta / on-by-default in 1.33+).
* Only CPU and memory can be resized in-place.
* Containers must have `resizePolicy` configured in their pod spec.
* Memory can typically only increase without a restart (runtime-dependent).
* Check `pod.Status.Resize` for the current resize state.
