Set deletion propagation for helm uninstall
Signed-off-by: Martin Hoffmann <martin.hoffmann01@sap.com> Signed-off-by: Martin Hoffmann <hoffimar@gmail.com>
This commit is contained in:
parent
be3868edcb
commit
79e4b9a099
|
@ -828,6 +828,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
|
||||
|
@ -839,6 +846,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
|
||||
}
|
||||
|
||||
// HelmReleaseStatus defines the observed state of a HelmRelease.
|
||||
type HelmReleaseStatus struct {
|
||||
// ObservedGeneration is the last observed generation.
|
||||
|
|
|
@ -470,6 +470,11 @@ func (in *Uninstall) DeepCopyInto(out *Uninstall) {
|
|||
*out = new(metav1.Duration)
|
||||
**out = **in
|
||||
}
|
||||
if in.DeletionPropagation != nil {
|
||||
in, out := &in.DeletionPropagation, &out.DeletionPropagation
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Uninstall.
|
||||
|
|
|
@ -625,6 +625,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.
|
||||
|
|
|
@ -1940,6 +1940,19 @@ bool
|
|||
a Helm uninstall is performed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>deletionPropagation</code><br>
|
||||
<em>
|
||||
string
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>DeletionPropagation specifies the deletion propagation policy when
|
||||
a Helm uninstall is performed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -399,6 +399,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.DeletionPropagation = hr.Spec.GetUninstall().GetDeletionPropagation()
|
||||
uninstall.Wait = !hr.Spec.GetUninstall().DisableWait
|
||||
|
||||
_, err := uninstall.Run(hr.GetReleaseName())
|
||||
|
|
Loading…
Reference in New Issue