Skip to content

uninstall: add --custom flag to interactively pick extra data to delete#388

Merged
moshe-kabala merged 1 commit into
masterfrom
uninstall-custom-flag
Jun 30, 2026
Merged

uninstall: add --custom flag to interactively pick extra data to delete#388
moshe-kabala merged 1 commit into
masterfrom
uninstall-custom-flag

Conversation

@moshe-kabala

Copy link
Copy Markdown
Contributor

Why

Today uninstall deletes data in coarse, all-or-nothing groups via --purge, --cleanup, and --clear-data. There's no way to say "wipe Elasticsearch but keep my users/Keycloak" or "drop the MinIO blobs but keep Mongo metadata". This adds a --custom flag that does a normal uninstall (cluster removal) and then interactively asks which extra data to delete, item by item.

Behavior

tl-cli ... uninstall --custom removes the cluster (as a normal uninstall always does), then presents a multi-select menu:

Application data (under storage/, not recoverable)

  • Projects, datasets & job metadata (MongoDB) — storage/mongodb
  • Datasets, model weights & artifacts (MinIO) — storage/minio
  • Analyses, insights & sample data (Elasticsearch) — storage/elasticsearch
  • User accounts & login (Keycloak) — storage/keycloak
  • All application data (rollup — entire storage/)

Install config

  • Manifests (versions & params) — manifests/
  • Install hostname — hostname

Cache (recreatable)

  • Container image cache (containerd dir or Docker volume, whichever this platform uses)
  • In-cluster registry data (Zot) — registry/
  • Helm chart cache — helm-cache/

After selecting, it lists exactly what will be deleted and requires a y/N confirmation (default No). --custom is mutually exclusive with --purge/--cleanup/--clear-data. Selecting nothing just does a normal cluster-only uninstall.

Implementation

  • pkg/local/utils.go — add storage/mongodb + storage/minio dir constants and a RemoveDataSubDir helper (with sudo fallback) for targeted removals.
  • pkg/server/uninstall.go — add a CustomTarget enum and UninstallCustom, sharing the cluster-removal preamble with the existing Uninstall. The "all app data" rollup supersedes per-store selections; the container image cache clears both the containerd/ dir and the Docker volume. Deletions are best-effort (a failure is logged, the rest still run, first error returned).
  • cmd/server/uninstall.go — add the --custom flag, the survey multi-select menu, and the confirmation step.

Verification

  • go build ./..., go vet, and package tests (pkg/local, pkg/server) all pass.
  • uninstall --help shows the new flag.
  • The interactive prompt itself wasn't driven end-to-end (needs a TTY + a real install), but the survey multi-select follows the existing pattern in pkg/server/installation_params.go.

🤖 Generated with Claude Code

A normal uninstall removes the cluster and (depending on --purge/--cleanup/
--clear-data) wipes data in coarse, all-or-nothing groups. This adds a --custom
flag that performs a normal uninstall (cluster removal) and then interactively
asks which extra data to delete, per item:

  - Application data, per store: MongoDB, MinIO, Elasticsearch, Keycloak,
    plus an "all application data" rollup
  - Install config: manifests, hostname
  - Cache: container image cache (containerd dir or Docker volume), Zot
    registry data, helm chart cache

Implementation:
- pkg/local: add storage/mongodb and storage/minio dir constants and a
  RemoveDataSubDir helper (sudo fallback) for targeted removals.
- pkg/server: add CustomTarget enum and UninstallCustom, sharing the
  cluster-removal preamble with the existing Uninstall. Deletions are
  best-effort; the first error is returned so the command exits non-zero.
- cmd/server: add --custom (mutually exclusive with --purge/--cleanup/
  --clear-data), a survey multi-select menu, and a confirmation that lists
  exactly what will be deleted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@asafyehezkel asafyehezkel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@omriyonatani-tl omriyonatani-tl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@moshe-kabala moshe-kabala merged commit d012838 into master Jun 30, 2026
1 check passed
@moshe-kabala moshe-kabala deleted the uninstall-custom-flag branch June 30, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants