From 7c0300f47b82ad2696d73d3230f9c65155cd9342 Mon Sep 17 00:00:00 2001 From: Samuel Torres Date: Tue, 15 Feb 2022 18:03:58 +0000 Subject: [PATCH] Add disableWait property on Helm Release Uninstall 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..a9817e33d 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:"wait,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..98cff886c 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -506,6 +506,10 @@ spec: operation (like Jobs for hooks) during the performance of a Helm uninstall action. Defaults to 'HelmReleaseSpec.Timeout'. type: string + wait: + description: DisableWait disables the waiting for resources to + be deleted before finalizing the Helm Release. + type: boolean type: object upgrade: description: Upgrade holds the configuration for Helm upgrade actions diff --git a/docs/api/helmrelease.md b/docs/api/helmrelease.md index 121942186..f0d7442e8 100644 --- a/docs/api/helmrelease.md +++ b/docs/api/helmrelease.md @@ -1755,6 +1755,19 @@ bool release as deleted, but retain the release history.

+ + +wait
+ +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)