Show suggestion for rejected unhealthy drivers

Normally how to add root permissions for the user, to be able to
run the "docker" or "podman" driver (through group or through sudo)
pull/11357/head
Anders F Björklund 2021-05-09 21:08:53 +02:00
parent c214b040e6
commit 6ea3ffee1f
4 changed files with 7 additions and 0 deletions

View File

@ -591,6 +591,9 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
out.Step(style.ThumbsDown, "Unable to pick a default driver. Here is what was considered, in preference order:") out.Step(style.ThumbsDown, "Unable to pick a default driver. Here is what was considered, in preference order:")
for _, r := range rejects { for _, r := range rejects {
out.Infof("{{ .name }}: {{ .rejection }}", out.V{"name": r.Name, "rejection": r.Rejection}) out.Infof("{{ .name }}: {{ .rejection }}", out.V{"name": r.Name, "rejection": r.Rejection})
if r.Suggestion != "" {
out.Infof("{{ .name }}: Suggestion: {{ .suggestion}}", out.V{"name": r.Name, "suggestion": r.Suggestion})
}
} }
exit.Message(reason.DrvNotDetected, "No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/") exit.Message(reason.DrvNotDetected, "No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/")
} }

View File

@ -289,6 +289,7 @@ func Suggest(options []registry.DriverState) (registry.DriverState, []registry.D
if !ds.State.Healthy { if !ds.State.Healthy {
ds.Rejection = fmt.Sprintf("Not healthy: %v", ds.State.Error) ds.Rejection = fmt.Sprintf("Not healthy: %v", ds.State.Error)
ds.Suggestion = fmt.Sprintf("%s <%s>", ds.State.Fix, ds.State.Doc)
rejects = append(rejects, ds) rejects = append(rejects, ds)
continue continue
} }

View File

@ -72,6 +72,8 @@ type DriverState struct {
State State State State
// Rejection is why we chose not to use this driver // Rejection is why we chose not to use this driver
Rejection string Rejection string
// Suggestion is how the user could improve health
Suggestion string
} }
func (d DriverState) String() string { func (d DriverState) String() string {

View File

@ -848,6 +848,7 @@
"version yaml failure": "", "version yaml failure": "",
"zsh completion failed": "", "zsh completion failed": "",
"zsh completion.": "", "zsh completion.": "",
"{{ .name }}: Suggestion: {{ .suggestion}}": "",
"{{ .name }}: {{ .rejection }}": "", "{{ .name }}: {{ .rejection }}": "",
"{{.Driver}} is currently using the {{.StorageDriver}} storage driver, consider switching to overlay2 for better performance": "", "{{.Driver}} is currently using the {{.StorageDriver}} storage driver, consider switching to overlay2 for better performance": "",
"{{.count}} nodes stopped.": "", "{{.count}} nodes stopped.": "",