Skip to content

Commit

Permalink
operator uninstall: add --delete-all,-X flag
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanford committed Aug 3, 2020
1 parent b8911ee commit 64c157b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/pkg/action/operator_uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type OperatorUninstall struct {
Package string
DeleteOperatorGroup bool
DeleteCRDs bool
DeleteAll bool
}

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

func (u *OperatorUninstall) Run(ctx context.Context) error {
if u.DeleteAll {
u.DeleteCRDs = true
u.DeleteOperatorGroup = true
}

subs := v1alpha1.SubscriptionList{}
if err := u.config.Client.List(ctx, &subs, client.InNamespace(u.config.Namespace)); err != nil {
return fmt.Errorf("list subscriptions: %v", err)
Expand Down

0 comments on commit 64c157b

Please sign in to comment.