# Kubernetes Configuration

This directory contains Kubernetes manifests and configuration for the video infrastructure.

## Managing CRDs

The file `all-crds.yaml` contains all Custom Resource Definitions (CRDs) required by the monitoring stack (Prometheus Operator).

### When to update CRDs

You should regenerate `all-crds.yaml` by running `scripts/update-crds.sh` when:

1.  **Upgrading the `kube-prometheus-stack` Helm chart**: If you bump the chart version in `k8s/monitoring/Chart.yaml` and update the dependencies, you must also update the CRDs to match the new version.
2.  **Missing CRD fields**: If you encounter errors like `field not declared in schema` during ArgoCD syncs, it likely means the installed CRDs are outdated.
3.  **Apply the CRDs**:
    Since Helm does not manage CRD upgrades, you must apply the updated CRDs manually. You may need `--force-conflicts` if ArgoCD previously managed these resources:
    ```bash
    kubectl apply --server-side --force-conflicts -f k8s/all-crds.yaml
    ```

4.  **Commit and Push**:
    Commit the updated `k8s/all-crds.yaml` to the repository.
    ```bash
    git add k8s/all-crds.yaml
    git commit -m "Update Prometheus CRDs"
    git push
    ```

### How to update

Run the update script from the repository root:

```bash
./scripts/update-crds.sh
```

This script extracts the CRDs from the local `kube-prometheus-stack` chart package and concatenates them into `k8s/all-crds.yaml`.
