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

Delete the existing cluster if guest driver mismatch #10084

Merged
merged 2 commits into from
Jan 6, 2021
Merged
Changes from all commits
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
14 changes: 14 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,20 @@ func validateSpecifiedDriver(existing *config.ClusterConfig) {
return
}

out.WarningT("Deleting existing cluster {{.name}} with different driver {{.driver_name}} due to --delete-on-failure flag set by the user. ", out.V{"name": existing.Name, "driver_name": old})
if viper.GetBool(deleteOnFailure) {
// Start failed, delete the cluster
profile, err := config.LoadProfile(existing.Name)
if err != nil {
out.ErrT(style.Meh, `"{{.name}}" profile does not exist, trying anyways.`, out.V{"name": existing.Name})
}

err = deleteProfile(profile)
azhao155 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
out.WarningT("Failed to delete cluster {{.name}}.", out.V{"name": existing.Name})
}
}

exit.Advice(
reason.GuestDrvMismatch,
`The existing "{{.name}}" cluster was created using the "{{.old}}" driver, which is incompatible with requested "{{.new}}" driver.`,
Expand Down