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 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
27 changes: 20 additions & 7 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,16 +668,29 @@ func validateSpecifiedDriver(existing *config.ClusterConfig) {
return
}

out.WarningT("Start deleting cluster {{.name}} with delete-on-failure flag set", out.V{"name": existing.Name})
azhao155 marked this conversation as resolved.
Show resolved Hide resolved
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.`,
"Delete the existing '{{.name}}' cluster using: '{{.delcommand}}', or start the existing '{{.name}}' cluster using: '{{.command}} --driver={{.old}}'",
`The existing "{{.name}}" cluster was created using the "{{.old}}" driver, which is incompatible with requested "{{.new}}" driver. Deleted the existing '{{.name}}' cluster.`,
azhao155 marked this conversation as resolved.
Show resolved Hide resolved
"Start the new '{{.name}}' cluster using: '{{.command}} --driver={{.new}}'",
out.V{
"name": existing.Name,
"new": requested,
"old": old,
"command": mustload.ExampleCmd(existing.Name, "start"),
"delcommand": mustload.ExampleCmd(existing.Name, "delete"),
"name": existing.Name,
"new": requested,
"old": old,
"command": mustload.ExampleCmd(existing.Name, "start"),
},
)
}
Expand Down