Repository navigation
fix(cli): uninstall everything kagent install creates - #3285
Merged
Merged
Conversation
Uninstall removes the kagent and Substrate releases, their CRDs, the bundled PostgreSQL, the Substrate namespaces, and the ClusterTrustBundles Substrate's controllers publish. SandboxTemplates and SandboxConfigs are deleted while the controllers that finalize them still run, so CRD deletion cannot hang. Uninstall stops when the kagent release is in a different namespace than --namespace. A database not deployed by install, and the kagent namespace, stay. Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
EItanya
approved these changes
Oct 20, 2026
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.
Description
kagent uninstallnow removes everythingkagent installcreates, and exits non-zero when a step fails. Before, it removed only thekagentandkagent-crdsreleases, fell back to deleting a hard-coded list of CRDs, and printed errors but exited 0.Uninstall runs these steps in order, each Helm release with
helm uninstall --wait:kagent.dev/sandbox-preparationfinalizer.kagentreleasesandboxconfig.ate.dev/workerpool-protectionfinalizer.substratereleasedeployment/kagent-postgresqlexists in the kagent namespace.substrate-podcertreleasesubstrate-crdsandkagent-crdsreleasesate.dev/api-accesslabel on the kagent namespaceate-systemandpodcertificate-controller-systemnamespacesBehavior
kagentrelease exists only in a namespace other than--namespace, uninstall stops before deleting anything and names the namespace to pass.substraterelease deletes the agents and the snapshot store its rows refer to, so there is no option to keep it.kubectl delete namespacecommand);--skip-database-setup;deleteCRDsand its hard-coded CRD list are removed. Install's error for kagent CRDs that exist outside Helm no longer suggestskagent uninstall.Testing
TestUninstallReversesInstallruns uninstall against fakehelmandkubectlbinaries and checks the exact command sequence for four cases: a bundled database,--skip-database-setup, a rerun after the CRDs and kagent namespace are gone, and akagentrelease in another namespace.go vet ./core/cli/...andgo test ./core/cli/internal/commands/.