Skip to content

Commit

Permalink
Merge pull request #416 from samueltorres/add-uninstall-wait-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco committed Feb 16, 2022
2 parents dedffc0 + ba35b00 commit 317bce5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 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"`

// DisableWait disables waiting for all the resources to be deleted after
// a Helm uninstall is performed.
// +optional
DisableWait bool `json:"disableWait,omitempty"`
}

// GetTimeout returns the configured timeout for the Helm uninstall action, or
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ spec:
description: DisableHooks prevents hooks from running during the
Helm rollback action.
type: boolean
disableWait:
description: DisableWait disables waiting for all the resources
to be deleted after a Helm uninstall is performed.
type: boolean
keepHistory:
description: KeepHistory tells Helm to remove all associated resources
and mark the release as deleted, but retain the release history.
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>disableWait</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>DisableWait disables waiting for all the resources to be deleted after
a Helm uninstall is performed.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
9 changes: 7 additions & 2 deletions docs/spec/v2beta1/helmreleases.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ type Uninstall struct {
// release as deleted, but retain the release history.
// +optional
KeepHistory bool `json:"keepHistory,omitempty"`

// DisableWait disables waiting for all the resources to be deleted after
// a Helm uninstall is performed.
// +optional
DisableWait bool `json:"disableWait,omitempty"`
}

// Kustomize Helm PostRenderer specification.
Expand Down Expand Up @@ -786,8 +791,8 @@ kubectl get all --all-namespaces \

### Disabling resource waiting

For install, upgrade, and rollback actions resource waiting is enabled by default,
but can be disabled by setting `spec.<action>.disableWait`.
For install, upgrade, rollback, and uninstall actions resource waiting is
enabled by default, but can be disabled by setting `spec.<action>.disableWait`.

Waiting for jobs to complete is enabled by default,
but can be disabled by setting `spec.<action>.disableWaitForJobs`.
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().DisableWait

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

0 comments on commit 317bce5

Please sign in to comment.