From 72ccc74ef156f42b727051e298b92dba624e8ccd Mon Sep 17 00:00:00 2001 From: Samuel Torres Date: Tue, 15 Feb 2022 18:07:59 +0000 Subject: [PATCH] Add disableWait property on Helm Release Unnstall Users can now tell Helm Controller to not for all the Helm managed resources to be deleted before finalizing the Helm Release resource. Signed-off-by: Samuel Torres --- api/v2beta1/helmrelease_types.go | 5 +++++ .../bases/helm.toolkit.fluxcd.io_helmreleases.yaml | 4 ++++ docs/api/helmrelease.md | 13 +++++++++++++ internal/runner/runner.go | 1 + 4 files changed, 23 insertions(+) diff --git a/api/v2beta1/helmrelease_types.go b/api/v2beta1/helmrelease_types.go index 6fa683d18..aa69e544a 100644 --- a/api/v2beta1/helmrelease_types.go +++ b/api/v2beta1/helmrelease_types.go @@ -754,6 +754,11 @@ type Uninstall struct { // release as deleted, but retain the release history. // +optional KeepHistory bool `json:"keepHistory,omitempty"` + + // DisableWait disables the waiting for resources to be deleted before + // finalizing the Helm Release. + // +optional + DisableWait bool `json:"disableWait,omitempty"` } // GetTimeout returns the configured timeout for the Helm uninstall action, or diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml index 163abc892..274412261 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -497,6 +497,10 @@ spec: description: DisableHooks prevents hooks from running during the Helm rollback action. type: boolean + disableWait: + description: DisableWait disables the waiting for resources to + be deleted before finalizing the Helm Release. + type: boolean keepHistory: description: KeepHistory tells Helm to remove all associated resources and mark the release as deleted, but retain the release history. diff --git a/docs/api/helmrelease.md b/docs/api/helmrelease.md index 121942186..fe9fb7c5c 100644 --- a/docs/api/helmrelease.md +++ b/docs/api/helmrelease.md @@ -1755,6 +1755,19 @@ bool release as deleted, but retain the release history.

+ + +disableWait
+ +bool + + + +(Optional) +

DisableWait disables the waiting for resources to be deleted before +finalizing the Helm Release.

+ + diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 9ffd92c29..0b848752b 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -375,6 +375,7 @@ func (r *Runner) Uninstall(hr v2.HelmRelease) error { uninstall.Timeout = hr.Spec.GetUninstall().GetTimeout(hr.GetTimeout()).Duration uninstall.DisableHooks = hr.Spec.GetUninstall().DisableHooks uninstall.KeepHistory = hr.Spec.GetUninstall().KeepHistory + uninstall.Wait = !hr.Spec.GetUninstall().DisableWait _, err := uninstall.Run(hr.GetReleaseName()) return wrapActionErr(r.logBuffer, err)