Skip to content

Implement 'uninstall' command with clean removal #17

@y0s3ph

Description

@y0s3ph

Context

The `k8scope uninstall` command should cleanly remove all components and optionally their data (PVCs). It must handle partial installations gracefully.

Requirements

Uninstall flow

  1. Detect installed components (via Helm releases with `k8scope` labels)
  2. Show what will be removed
  3. Ask for confirmation (unless `--confirm` flag)
  4. Remove components in reverse dependency order:
    • OTel Collector (stop ingestion first)
    • Alertmanager
    • Grafana
    • Loki
    • Prometheus (last, as others depend on its CRDs)
  5. Optionally remove PVCs (`--delete-data`)
  6. Optionally remove namespace (`--delete-namespace`)
  7. 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

  • Clean removal of all components
  • PVCs preserved by default
  • Works with partial installations (some components missing)
  • Proper ordering prevents dangling resources
  • `--delete-data` asks for explicit confirmation

Metadata

Metadata

Assignees

Labels

component:cliCLI and user experiencephase:4-dxPhase 4: Developer experiencepriority:highImportant but not blocking

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions