# Prometheus Operator CRDs

This directory contains the CustomResourceDefinitions (CRDs) for the Prometheus Operator.

## Why Separate CRDs?

These CRDs are managed separately from the main `kube-prometheus-stack` Helm chart to avoid:

1. **Large Annotation Error**: Helm stores the full manifest in annotations, which can exceed Kubernetes' 262144-byte limit for CRDs
2. **CRD Installation Race Conditions**: Ensures CRDs are installed before any resources that depend on them

## Deployment Method

These CRDs are **manually deployed** using kubectl server-side apply:

```bash
kubectl apply --server-side=true --force-conflicts -f manifests/prometheus-operator-crds/
```

**Note**: Server-side apply is required to bypass the annotation size limit that affects large CRDs.

## CRDs Included

- `crd-alertmanagerconfigs.yaml` - AlertmanagerConfig resources
- `crd-alertmanagers.yaml` - Alertmanager resources
- `crd-podmonitors.yaml` - PodMonitor resources
- `crd-probes.yaml` - Probe resources
- `crd-prometheusagents.yaml` - PrometheusAgent resources
- `crd-prometheuses.yaml` - Prometheus resources
- `crd-prometheusrules.yaml` - PrometheusRule resources
- `crd-scrapeconfigs.yaml` - ScrapeConfig resources
- `crd-servicemonitors.yaml` - ServiceMonitor resources
- `crd-thanosrulers.yaml` - ThanosRuler resources

## Updating CRDs

When updating the `kube-prometheus-stack` chart version:

1. Copy the new CRDs from `charts/kube-prometheus-stack/charts/crds/crds/` to this directory
2. Reapply them: `kubectl apply --server-side=true --force-conflicts -f manifests/prometheus-operator-crds/`
3. Then update the main stack via ArgoCD

## Related Configuration

- Main stack values: `manifests/kube-prometheus-stack/values.yaml` has `crds.enabled: false`
- Main ArgoCD app: `argocd-apps/kube-prometheus-stack.yaml`
