Add disableWait property on Helm uninstall

This commit changes the default behavior of the Helm uninstall action
to wait for all resources to be deleted, and introduces a
`.spec.uninstall.disableWait` flag to disable this behavior.

Signed-off-by: Samuel Torres <samuelpirestorres@gmail.com>
This commit is contained in:
Samuel Torres 2022-02-15 18:07:59 +00:00 committed by Hidde Beydals
parent dedffc0557
commit 7d6c0f7c47
4 changed files with 23 additions and 0 deletions

View File

@ -754,6 +754,11 @@ type Uninstall struct {
// release as deleted, but retain the release history. // release as deleted, but retain the release history.
// +optional // +optional
KeepHistory bool `json:"keepHistory,omitempty"` 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 // GetTimeout returns the configured timeout for the Helm uninstall action, or

View File

@ -497,6 +497,10 @@ spec:
description: DisableHooks prevents hooks from running during the description: DisableHooks prevents hooks from running during the
Helm rollback action. Helm rollback action.
type: boolean type: boolean
disableWait:
description: DisableWait disables waiting for all the resources
to be deleted after a Helm uninstall is performed.
type: boolean
keepHistory: keepHistory:
description: KeepHistory tells Helm to remove all associated resources description: KeepHistory tells Helm to remove all associated resources
and mark the release as deleted, but retain the release history. and mark the release as deleted, but retain the release history.

View File

@ -1755,6 +1755,19 @@ bool
release as deleted, but retain the release history.</p> release as deleted, but retain the release history.</p>
</td> </td>
</tr> </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> </tbody>
</table> </table>
</div> </div>

View File

@ -375,6 +375,7 @@ func (r *Runner) Uninstall(hr v2.HelmRelease) error {
uninstall.Timeout = hr.Spec.GetUninstall().GetTimeout(hr.GetTimeout()).Duration uninstall.Timeout = hr.Spec.GetUninstall().GetTimeout(hr.GetTimeout()).Duration
uninstall.DisableHooks = hr.Spec.GetUninstall().DisableHooks uninstall.DisableHooks = hr.Spec.GetUninstall().DisableHooks
uninstall.KeepHistory = hr.Spec.GetUninstall().KeepHistory uninstall.KeepHistory = hr.Spec.GetUninstall().KeepHistory
uninstall.Wait = !hr.Spec.GetUninstall().DisableWait
_, err := uninstall.Run(hr.GetReleaseName()) _, err := uninstall.Run(hr.GetReleaseName())
return wrapActionErr(r.logBuffer, err) return wrapActionErr(r.logBuffer, err)