Skip to content

Commit 64c157b

Browse files
committed
operator uninstall: add --delete-all,-X flag
1 parent b8911ee commit 64c157b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/pkg/action/operator_uninstall.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type OperatorUninstall struct {
2121
Package string
2222
DeleteOperatorGroup bool
2323
DeleteCRDs bool
24+
DeleteAll bool
2425
}
2526

2627
func NewOperatorUninstall(cfg *Configuration) *OperatorUninstall {
@@ -32,9 +33,15 @@ func NewOperatorUninstall(cfg *Configuration) *OperatorUninstall {
3233
func (u *OperatorUninstall) BindFlags(fs *pflag.FlagSet) {
3334
fs.BoolVar(&u.DeleteOperatorGroup, "delete-operator-group", false, "delete operator group if no other operators remain")
3435
fs.BoolVar(&u.DeleteCRDs, "delete-crds", false, "delete all owned CRDs and all CRs")
36+
fs.BoolVarP(&u.DeleteAll, "delete-add", "X", false, "enable all delete flags")
3537
}
3638

3739
func (u *OperatorUninstall) Run(ctx context.Context) error {
40+
if u.DeleteAll {
41+
u.DeleteCRDs = true
42+
u.DeleteOperatorGroup = true
43+
}
44+
3845
subs := v1alpha1.SubscriptionList{}
3946
if err := u.config.Client.List(ctx, &subs, client.InNamespace(u.config.Namespace)); err != nil {
4047
return fmt.Errorf("list subscriptions: %v", err)

0 commit comments

Comments
 (0)