helm-controller
helm-controller copied to clipboard
Perform an installation if last release status is "uninstalled"
During a HelmRelease reconciliation cycle, Helm-Controller decides to perform an install or an upgrade based on the fact that a revision of a release with the provided name exists ( https://github.com/fluxcd/helm-controller/blob/main/controllers/helmrelease_controller.go#L291 ).
if at least a revision exists, it performs an upgrade, otherwise an install: (https://github.com/fluxcd/helm-controller/blob/e9d31e9f1f8df5149b10ce7719b2d272f617a44f/controllers/helmrelease_controller.go#L344-L356)
For HelmReleases configured with
uninstall:
keepHistory: true
install:
remediation:
retries: 3
this behavior creates a situation where, if the first installation fails, the uninstall performed before the following installation attempt doesn't purge the history, but retains a record of this particular release being in status "uninstalled".
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Thu Nov 25 17:01:58 2021 uninstalled mychart-0.0.3 1.2.0 Uninstallation complete
The next reconciliation will find this revision when calling run.ObserveLastRelease
and will decide to perform an upgrade, which will fail because the underlying helm logic returns a "my-chart has no deployed releases" error.
From this issue, it looks like this is helm intended behavior for the upgrade action, and instead, a user should recover from this situation performing a helm install --replace
.
However, in this situation, Helm-Controller won't perform any more installations of the release, and any further modification will end up in a upgrade.
Is it possible to change this behavior and perform an install if the release last status is "uninstalled"?
Should be taken into account as part of #324
to add some more context and explanation I've opened a draft PR for a possible solution (if this is confirmed as something to change by the maintainers): https://github.com/fluxcd/helm-controller/pull/368
@hiddeco from your comment it looks like you agree that the current behavior should change?