uninstall: add --custom flag to interactively pick extra data to delete#388
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Today
uninstalldeletes 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--customflag that does a normal uninstall (cluster removal) and then interactively asks which extra data to delete, item by item.Behavior
tl-cli ... uninstall --customremoves the cluster (as a normal uninstall always does), then presents a multi-select menu:Application data (under
storage/, not recoverable)storage/mongodbstorage/miniostorage/elasticsearchstorage/keycloakstorage/)Install config
manifests/hostnameCache (recreatable)
registry/helm-cache/After selecting, it lists exactly what will be deleted and requires a
y/Nconfirmation (default No).--customis mutually exclusive with--purge/--cleanup/--clear-data. Selecting nothing just does a normal cluster-only uninstall.Implementation
pkg/local/utils.go— addstorage/mongodb+storage/miniodir constants and aRemoveDataSubDirhelper (with sudo fallback) for targeted removals.pkg/server/uninstall.go— add aCustomTargetenum andUninstallCustom, sharing the cluster-removal preamble with the existingUninstall. The "all app data" rollup supersedes per-store selections; the container image cache clears both thecontainerd/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--customflag, thesurveymulti-select menu, and the confirmation step.Verification
go build ./...,go vet, and package tests (pkg/local,pkg/server) all pass.uninstall --helpshows the new flag.pkg/server/installation_params.go.🤖 Generated with Claude Code