Context
The `k8scope uninstall` command should cleanly remove all components and optionally their data (PVCs). It must handle partial installations gracefully.
Requirements
Uninstall flow
- Detect installed components (via Helm releases with `k8scope` labels)
- Show what will be removed
- Ask for confirmation (unless `--confirm` flag)
- Remove components in reverse dependency order:
- OTel Collector (stop ingestion first)
- Alertmanager
- Grafana
- Loki
- Prometheus (last, as others depend on its CRDs)
- Optionally remove PVCs (`--delete-data`)
- Optionally remove namespace (`--delete-namespace`)
- Optionally remove CRDs (`--delete-crds`)
Flags
- `--confirm` — Skip confirmation prompt
- `--delete-data` — Also delete PVCs (data loss warning)
- `--delete-namespace` — Delete the k8scope namespace
- `--delete-crds` — Remove Prometheus Operator CRDs (dangerous, affects other Prometheus installations)
- `--component prometheus` — Uninstall a single component
Safety
- Default behavior: remove releases only, keep PVCs and namespace
- `--delete-data` requires explicit confirmation even with `--confirm`
- Warn if CRD removal would affect other namespaces
Acceptance criteria
Context
The `k8scope uninstall` command should cleanly remove all components and optionally their data (PVCs). It must handle partial installations gracefully.
Requirements
Uninstall flow
Flags
Safety
Acceptance criteria