Skip to content

Commit

Permalink
Add uninstall wait flag
Browse files Browse the repository at this point in the history
Add a uninstall wait property on Helm Release Uninstall
API. So users can set whether Helm Controller waits for all the
Helm managed resources to be deleted before finalizing the
Helm Release resource.
  • Loading branch information
samuel-form3 committed Feb 13, 2022
1 parent ff258dd commit 5163b5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/v2beta1/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,11 @@ type Uninstall struct {
// release as deleted, but retain the release history.
// +optional
KeepHistory bool `json:"keepHistory,omitempty"`

// Wait tells Helm to wait for all the resources are deleted before finalizing
// the resource. It will wait for as long as the configured uninstall timeout.
// +optional
Wait bool `json:"wait,omitempty"`
}

// GetTimeout returns the configured timeout for the Helm uninstall action, or
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ spec:
operation (like Jobs for hooks) during the performance of a
Helm uninstall action. Defaults to 'HelmReleaseSpec.Timeout'.
type: string
wait:
description: Wait tells Helm to wait for all the resources are
deleted before finalizing the resource. It will wait for as
long as the configured uninstall timeout.
type: boolean
type: object
upgrade:
description: Upgrade holds the configuration for Helm upgrade actions
Expand Down
13 changes: 13 additions & 0 deletions docs/api/helmrelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,19 @@ bool
release as deleted, but retain the release history.</p>
</td>
</tr>
<tr>
<td>
<code>wait</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Wait tells Helm to wait for all the resources are deleted before finalizing
the resource. It will wait for as long as the configured uninstall timeout.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
1 change: 1 addition & 0 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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().Wait

_, err := uninstall.Run(hr.GetReleaseName())
return wrapActionErr(r.logBuffer, err)
Expand Down

0 comments on commit 5163b5d

Please sign in to comment.