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

Make uninstall more robust and informative #3618

Merged
merged 6 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Addressed Dave's review
Signed-off-by: Carlisia <carlisia@vmware.com>
  • Loading branch information
Carlisia committed Mar 25, 2021
commit 61c891f05565adcc01110f72d0293dafcc55f778
7 changes: 4 additions & 3 deletions pkg/cmd/cli/uninstall/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type uninstallOptions struct {

// BindFlags adds command line values to the options struct.
func (o *uninstallOptions) BindFlags(flags *pflag.FlagSet) {
flags.BoolVar(&o.wait, "wait", o.wait, "Wait for Velero deployment to be ready. Optional.")
flags.BoolVar(&o.wait, "wait", o.wait, "Wait for Velero uninstall to be ready. Optional.")
flags.BoolVar(&o.force, "force", o.force, "Forces the Velero uninstall. Optional.")
carlisia marked this conversation as resolved.
Show resolved Hide resolved
}

Expand All @@ -63,7 +63,7 @@ func NewCommand(f client.Factory) *cobra.Command {
Long: `Uninstall Velero along with the CRDs.

The '--namespace' flag can be used to specify the namespace where velero is installed (default: velero).
Use '--wait' to wait for the Velero Deployment to be ready before proceeding.
Use '--wait' to wait for the Velero uninstall to be ready before proceeding.
Use '--force' to skip the prompt confirming if you want to uninstall Velero.
`,
Example: `# velero uninstall -n staging`,
carlisia marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -134,7 +134,8 @@ func Run(ctx context.Context, client *kubernetes.Clientset, extensionsClient *ap
} else {
for _, removeCRD := range crds.Items {
if err = extensionsClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, removeCRD.ObjectMeta.Name, metav1.DeleteOptions{}); err != nil {
errs = append(errs, errors.WithStack(err))
err2 := errors.WithMessagef(err, "Uninstall failed removing CRD %s", removeCRD.ObjectMeta.Name)
errs = append(errs, errors.WithStack(err2))
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions test/e2e/velero_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,7 @@ func VeleroInstall(ctx context.Context, veleroImage string, veleroNamespace stri
}

func VeleroUninstall(ctx context.Context, client *kubernetes.Clientset, extensionsClient *apiextensionsclient.Clientset, veleroNamespace string) error {
err := uninstall.Run(ctx, client, extensionsClient, veleroNamespace, true)
if err != nil {
return err
}

return nil
return uninstall.Run(ctx, client, extensionsClient, veleroNamespace, true)
}

func VeleroBackupLogs(ctx context.Context, veleroCLI string, veleroNamespace string, backupName string) error {
Expand Down