Skip to content

Commit 2340d98

Browse files
committed
Allow HelmRelease uninstall even if suspended
1 parent 8d1afa6 commit 2340d98

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

api/v2beta1/helmrelease_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,9 @@ type Uninstall struct {
807807
// a Helm uninstall is performed.
808808
// +optional
809809
DisableWait bool `json:"disableWait,omitempty"`
810+
811+
// IfSuspended uninstalls the release even if it is suspended
812+
IfSuspended bool `json:"ifSuspended,omitempty"`
810813
}
811814

812815
// GetTimeout returns the configured timeout for the Helm uninstall action, or

config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,10 @@ spec:
598598
description: DisableWait disables waiting for all the resources
599599
to be deleted after a Helm uninstall is performed.
600600
type: boolean
601+
ifSuspended:
602+
description: IfSuspended uninstalls the release even if it is
603+
suspended
604+
type: boolean
601605
keepHistory:
602606
description: KeepHistory tells Helm to remove all associated resources
603607
and mark the release as deleted, but retain the release history.

controllers/helmrelease_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,9 @@ func (r *HelmReleaseReconciler) reconcileDelete(ctx context.Context, hr v2.HelmR
623623
return ctrl.Result{}, err
624624
}
625625

626-
// Only uninstall the Helm Release if the resource is not suspended.
627-
if !hr.Spec.Suspend {
626+
// Only uninstall the Helm Release if the resource is not suspended or if it
627+
// is configured to ignore suspension.
628+
if !hr.Spec.Suspend || hr.Spec.Uninstall.IfSuspended {
628629
getter, err := r.buildRESTClientGetter(ctx, hr)
629630
if err != nil {
630631
return ctrl.Result{}, err

docs/api/helmrelease.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,17 @@ bool
18771877
a Helm uninstall is performed.</p>
18781878
</td>
18791879
</tr>
1880+
<tr>
1881+
<td>
1882+
<code>ifSuspended</code><br>
1883+
<em>
1884+
bool
1885+
</em>
1886+
</td>
1887+
<td>
1888+
<p>IfSuspended uninstalls the release even if it is suspended</p>
1889+
</td>
1890+
</tr>
18801891
</tbody>
18811892
</table>
18821893
</div>

0 commit comments

Comments
 (0)