Skip to content

Commit

Permalink
api: backport uninstall del propagation to v2beta2
Browse files Browse the repository at this point in the history
Manual backport of the work done in #698, to keep things aligned.

Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Oct 27, 2023
1 parent 621718f commit d91e234
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions api/v2beta2/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,13 @@ type Uninstall struct {
// a Helm uninstall is performed.
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DeletionPropagation specifies the deletion propagation policy when
// a Helm uninstall is performed.
// +kubebuilder:default=background
// +kubebuilder:validation:Enum=background;foreground;orphan
// +optional
DeletionPropagation *string `json:"deletionPropagation,omitempty"`
}

// GetTimeout returns the configured timeout for the Helm uninstall action, or
Expand All @@ -812,6 +819,15 @@ func (in Uninstall) GetTimeout(defaultTimeout metav1.Duration) metav1.Duration {
return *in.Timeout
}

// GetDeletionPropagation returns the configured deletion propagation policy
// for the Helm uninstall action, or 'background'.
func (in Uninstall) GetDeletionPropagation() string {
if in.DeletionPropagation == nil {
return "background"
}
return *in.DeletionPropagation
}

// HelmReleaseInfo holds the status information for a Helm release as performed
// by the controller.
type HelmReleaseInfo struct {
Expand Down
5 changes: 5 additions & 0 deletions api/v2beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,15 @@ spec:
description: Uninstall holds the configuration for Helm uninstall
actions for this HelmRelease.
properties:
deletionPropagation:
default: background
description: DeletionPropagation specifies the deletion propagation
policy when a Helm uninstall is performed.
enum:
- background
- foreground
- orphan
type: string
disableHooks:
description: DisableHooks prevents hooks from running during the
Helm rollback action.
Expand Down
1 change: 1 addition & 0 deletions internal/action/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func newUninstall(config *helmaction.Configuration, obj *v2.HelmRelease, opts []
uninstall.DisableHooks = obj.GetUninstall().DisableHooks
uninstall.KeepHistory = obj.GetUninstall().KeepHistory
uninstall.Wait = !obj.GetUninstall().DisableWait
uninstall.DeletionPropagation = obj.GetUninstall().GetDeletionPropagation()

for _, opt := range opts {
opt(uninstall)
Expand Down

0 comments on commit d91e234

Please sign in to comment.