# Installation

## Prerequisites

- Kubernetes 1.28+
- Helm 3.12+
- cert-manager (optional, for secure metrics)

## Helm Install

```bash
helm install drop oci://ghcr.io/corewire/charts/drop \
  --namespace drop-system \
  --create-namespace
```

### With Prometheus ServiceMonitor

```bash
helm install drop oci://ghcr.io/corewire/charts/drop \
  --namespace drop-system \
  --create-namespace \
  --set serviceMonitor.enabled=true \
  --set certManager.enabled=true
```

## CRD Management

Helm does not update CRDs on `helm upgrade`. For reliable CRD lifecycle
management, install CRDs separately using the **drop-crds** chart:

```bash
# Install CRDs independently
helm install drop-crds oci://ghcr.io/corewire/charts/drop-crds

# Install the operator with CRD installation disabled
helm install drop oci://ghcr.io/corewire/charts/drop \
  --namespace drop-system \
  --create-namespace \
  --set crds.install=false
```

To upgrade CRDs later:

```bash
helm upgrade drop-crds oci://ghcr.io/corewire/charts/drop-crds
```

### ArgoCD

When using ArgoCD, deploy CRDs and the operator as separate Applications so
that CRD updates are applied independently. See
[`examples/argocd/`](https://github.com/corewire/drop/tree/main/examples/argocd)
for ready-to-use Application manifests.

Key points for ArgoCD CRD management:

- Use `ServerSideApply=true` and `Replace=true` sync options on the CRDs Application.
- Set a negative sync-wave (`argocd.argoproj.io/sync-wave: "-1"`) so CRDs are synced before the operator.
- Disable `crds.install` in the operator chart values.

#### ArgoCD OCI Helm Repository Secret

If your ArgoCD setup needs an explicit Helm OCI repository entry, create this
repository Secret in the `argocd` namespace:

```yaml
apiVersion: v1
kind: Secret
metadata:
  name: argocd-repo-ghcr-corewire-charts
  namespace: argocd
  labels:
    argocd.argoproj.io/secret-type: repository
type: Opaque
stringData:
  name: ghcr-corewire-charts
  type: helm
  url: ghcr.io/corewire/charts
  enableOCI: "true"
```

### Renovate

The repository includes Renovate custom managers that automatically detect new
chart versions in the ArgoCD example manifests. Add similar regex managers to
your own `renovate.json` to keep chart references up to date:

```json
{
  "customManagers": [
    {
      "customType": "regex",
      "fileMatch": ["argocd/.*\\.yaml$"],
      "matchStrings": ["chart: drop-crds\\n\\s+repoURL: oci://ghcr\\.io/corewire/charts\\n\\s+targetRevision: (?<currentValue>\\S+)"],
      "depNameTemplate": "drop-crds",
      "datasourceTemplate": "docker",
      "packageNameTemplate": "ghcr.io/corewire/charts/drop-crds"
    }
  ]
}
```

## Verify

```bash
kubectl -n drop-system get pods
```

The operator Pod should be running and ready.

