Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --force flag to minio delete command #1687

Merged
merged 9 commits into from
Jul 25, 2023
Merged
8 changes: 6 additions & 2 deletions kubectl-minio/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type deleteCmd struct {
errOut io.Writer
output bool
operatorOpts resources.OperatorOptions
force bool
}

func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command {
Expand All @@ -57,8 +58,10 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command {
Example: deleteExample,
Args: cobra.MaximumNArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
if !helpers.Ask("Are you sure you want to delete ALL the MinIO Tenants and MinIO Operator, this is not a reversible operation") {
pjuarezd marked this conversation as resolved.
Show resolved Hide resolved
return fmt.Errorf(Bold("Aborting Operator deletion"))
if !o.force {
if !helpers.Ask("This will delete the MinIO Operator and ALL its data. Do you want to proceed") {
return fmt.Errorf("Aborting MinIO Operator deletion")
}
}
err := o.run(out)
if err != nil {
Expand All @@ -71,6 +74,7 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd = helpers.DisableHelp(cmd)
f := cmd.Flags()
f.StringVarP(&o.operatorOpts.Namespace, "namespace", "n", helpers.DefaultNamespace, "namespace scope for this request")
f.BoolVarP(&o.force, "force", "f", false, "force delete without confirmation")
pjuarezd marked this conversation as resolved.
Show resolved Hide resolved
return cmd
}

Expand Down