diff --git a/api/v2beta1/helmrelease_types.go b/api/v2beta1/helmrelease_types.go index 00d6a9d38..8eb94e49e 100644 --- a/api/v2beta1/helmrelease_types.go +++ b/api/v2beta1/helmrelease_types.go @@ -807,6 +807,9 @@ type Uninstall struct { // a Helm uninstall is performed. // +optional DisableWait bool `json:"disableWait,omitempty"` + + // IfSuspended uninstalls the release even if it is suspended. + IfSuspended bool `json:"ifSuspended,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 1ceb2af0b..404ef45d7 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -598,6 +598,10 @@ spec: description: DisableWait disables waiting for all the resources to be deleted after a Helm uninstall is performed. type: boolean + ifSuspended: + description: IfSuspended uninstalls the release even if it is + suspended. + 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/controllers/helmrelease_controller.go b/controllers/helmrelease_controller.go index 8ec202acc..a99e21a96 100644 --- a/controllers/helmrelease_controller.go +++ b/controllers/helmrelease_controller.go @@ -623,8 +623,9 @@ func (r *HelmReleaseReconciler) reconcileDelete(ctx context.Context, hr v2.HelmR return ctrl.Result{}, err } - // Only uninstall the Helm Release if the resource is not suspended. - if !hr.Spec.Suspend { + // Only uninstall the Helm Release if the resource is not suspended or if it + // is configured to ignore suspension. + if !hr.Spec.Suspend || hr.Spec.Uninstall.IfSuspended { getter, err := r.buildRESTClientGetter(ctx, hr) if err != nil { return ctrl.Result{}, err diff --git a/docs/api/helmrelease.md b/docs/api/helmrelease.md index b53cf1962..da72f2f46 100644 --- a/docs/api/helmrelease.md +++ b/docs/api/helmrelease.md @@ -1877,6 +1877,17 @@ bool a Helm uninstall is performed.

+ + +ifSuspended
+ +bool + + + +

IfSuspended uninstalls the release even if it is suspended.

+ +