address review comments
parent
4caf260279
commit
56b5524c8e
|
|
@ -1039,7 +1039,7 @@ func getKubernetesVersion(old *config.ClusterConfig) string {
|
|||
func maybeExitWithAdvice(err error) {
|
||||
if errors.Is(err, oci.ErrWindowsContainers) {
|
||||
out.ErrLn("")
|
||||
out.ErrT(out.Conflict, "Your Docker Desktop container os type is Windows but Linux is required.")
|
||||
out.ErrT(out.Conflict, "Your Docker Desktop container OS type is Windows but Linux is required.")
|
||||
out.T(out.Warning, "Please change Docker settings to use Linux containers instead of Windows containers.")
|
||||
out.T(out.Documentation, "https://minikube.sigs.k8s.io/docs/drivers/docker/#verify-docker-container-type-is-linux")
|
||||
exit.UsageT(`You can verify your Docker container type by running:
|
||||
|
|
@ -1049,15 +1049,20 @@ func maybeExitWithAdvice(err error) {
|
|||
|
||||
if errors.Is(err, oci.ErrCPUCountLimit) {
|
||||
out.ErrLn("")
|
||||
out.ErrT(out.Conflict, "Your {{.name}} doesn't have enough CPUs. ", out.V{"name": viper.GetString("driver")})
|
||||
out.ErrT(out.Conflict, "{{.name}} doesn't have enough CPUs. ", out.V{"name": viper.GetString("driver")})
|
||||
if runtime.GOOS != "linux" && viper.GetString("driver") == "docker" {
|
||||
out.T(out.Warning, "Please consider changing your Docker desktop's resources.")
|
||||
out.T(out.Documentation, "https://docs.docker.com/config/containers/resource_constraints/")
|
||||
} else {
|
||||
out.T(out.Warning, "Please ensure your system has at least {{.cpu_counts}} CPU cores", out.V{"cpu_counts": viper.GetInt(cpus)})
|
||||
cpuCount := viper.GetInt(cpus)
|
||||
if cpuCount == 2 {
|
||||
out.T(out.Tip, "Please ensure your system has {{.cpu_counts}} CPU cores.", out.V{"cpu_counts": viper.GetInt(cpus)})
|
||||
} else {
|
||||
out.T(out.Tip, "Please ensure your {{.driver_name}} system has access to {{.cpu_counts}} CPU cores or reduce the number of the specified CPUs", out.V{"driver_name": viper.GetString("driver"), "cpu_counts": viper.GetInt(cpus)})
|
||||
}
|
||||
}
|
||||
|
||||
exit.UsageT("Esnure your system has enough CPUs")
|
||||
exit.UsageT("Ensure your system has enough CPUs")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,11 @@ package oci
|
|||
|
||||
import "errors"
|
||||
|
||||
// FailFastError type is an error that could not be solved by trying again
|
||||
type FailFastError error
|
||||
|
||||
// ErrWindowsContainers is thrown when docker been configured to run windows containers instead of Linux
|
||||
var ErrWindowsContainers = errors.New("docker container type is windows")
|
||||
var ErrWindowsContainers = FailFastError(errors.New("docker container type is windows"))
|
||||
|
||||
// ErrCPUCountLimit is thrown when docker daemon doesn't have enough CPUs for the requested container
|
||||
var ErrCPUCountLimit = errors.New("not enough CPUs is available for container")
|
||||
var ErrCPUCountLimit = FailFastError(errors.New("not enough CPUs is available for container"))
|
||||
|
|
|
|||
|
|
@ -360,14 +360,7 @@ func startHost(api libmachine.API, cc *config.ClusterConfig, n *config.Node) (*h
|
|||
}
|
||||
}
|
||||
|
||||
// don't try to re-create if container type is windows.
|
||||
if errors.Is(err, oci.ErrWindowsContainers) {
|
||||
glog.Infof("will skip retrying to create machine because error is not retriable: %v", err)
|
||||
return host, exists, err
|
||||
}
|
||||
|
||||
// don't try to re-create if cpu count is not enough
|
||||
if errors.Is(err, oci.ErrCPUCountLimit) {
|
||||
if _, ff := err.(oci.FailFastError); ff {
|
||||
glog.Infof("will skip retrying to create machine because error is not retriable: %v", err)
|
||||
return host, exists, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue