hashgraph / hashgraph/solo-weaver
fix(cli): let `eso operator uninstall` clear a stalled or foreign-named ESO release
- Dominant language
- Go
- Stars
- 3
- Forks
- 0
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 47
Description
## Problem
`uninstallESOChart` (`internal/workflows/steps/step_external_secrets.go`) decides what to do from
`hm.IsInstalled(spec.Release, spec.Namespace)`:
```go
isInstalled, err := hm.IsInstalled(spec.Release, spec.Namespace)
if err != nil {
return false, err
}
if !isInstalled {
return false, nil
}
```
`IsInstalled` counts only `StatusDeployed` (`pkg/helm/manager.go`), and `spec.Release` is fixed by
the infrastructure catalog to `external-secrets`. So the command silently reports "not installed,
skipping" and **exits 0** for:
* a release stuck in `failed`, `pending-install`, `pending-upgrade`, `uninstalling`, or left
`uninstalled` by `helm uninstall --keep-history`;
* any ESO installed under a different release name - a hand-run
`helm install my-eso external-secrets/external-secrets`, or an ArgoCD/Flux-managed release.
Those are exactly the states the #887 singleton guard reports, which is why every hint it prints
names raw `helm uninstall -n ` rather than the CLI. An operator who reaches
for `eso operator uninstall` instead gets a clean exit and an unchanged cluster, then the same
install failure.
## The repo already solved this once
`UninstallSoloOperator` (`internal/workflows/steps/step_solo_operator.go`) gates on whether a
release *record* exists in any state, not on `IsInstalled`:
```go
// Gate on whether a release RECORD exists (any state), not on the
// deployed-only IsInstalled: a release stuck in pending-*/failed is exactly
// what needs clearing, and skipping it would leave a broken release that
// blocks the next install with "another operation ... in progress".
if _, err := hm.GetRelease(spec.Release, spec.Namespace); err != nil {
if errorx.IsOfType(err, helm.ErrNotFound) {
return automa.StepSkippedReport(stp.Id())
}
...
}
```
## Proposed fix
1. Gate `uninstallESOChart` on `GetRelease` (any state) with the `helm.ErrNotFound` skip, mirroring
`UninstallSoloOperator`.
2. Decide whether `--namespace` alone is enough to find a foreign-named ESO, or whether the
uninstall should locate the ESO release by chart name the way `checkESOSingleton` does. Reusing
`isESORelease` would make `eso operator uninstall` able to clear an ArgoCD-installed ESO, but it
also widens what the command may delete - worth an explicit decision, not a silent one.
3. Once (1) lands, point the #887 guard's stalled-release hint at
`sudo solo-provisioner eso operator uninstall --namespace ` and drop the caveat from
`docs/commands/alloy.md`.
4. `uninstallExternalSecrets` still uses the pre-errx `models.ErrPropertyResolution` hint style;
convert it to `errx.Decorate` + `reasons.*` in the same PR, per `docs/dev/error-handling.md`.
## Acceptance
- [ ] `eso operator uninstall` removes a release left in `failed`/`pending-*`/`uninstalled` state.
- [ ] It still skips (exit 0) when no release record exists at all.
- [ ] Unit tests cover deployed, stalled, and absent.
- [ ] The #887 guard hints and `docs/commands/alloy.md` are updated to match whatever (2) decides.
Contributor guide
Assessment
This issue has not been assessed yet.