Don't skip the check for too old versions for new

Even when starting a new profile, we still need to check the
k8s version parameter against the oldest supported version...

This helps guard against accidental errors like confusing the
kubernetes version (v1.17.3) with the minikube version (v1.8.1)
pull/7023/head
Anders F Björklund 2020-03-13 12:35:57 +01:00
parent 54e997e5cc
commit d81ba5b5cb
1 changed files with 4 additions and 4 deletions

View File

@ -1000,10 +1000,6 @@ func getKubernetesVersion(old *config.ClusterConfig) string {
} }
nv := version.VersionPrefix + nvs.String() nv := version.VersionPrefix + nvs.String()
if old == nil || old.KubernetesConfig.KubernetesVersion == "" {
return nv
}
oldestVersion, err := semver.Make(strings.TrimPrefix(constants.OldestKubernetesVersion, version.VersionPrefix)) oldestVersion, err := semver.Make(strings.TrimPrefix(constants.OldestKubernetesVersion, version.VersionPrefix))
if err != nil { if err != nil {
exit.WithCodeT(exit.Data, "Unable to parse oldest Kubernetes version from constants: {{.error}}", out.V{"error": err}) exit.WithCodeT(exit.Data, "Unable to parse oldest Kubernetes version from constants: {{.error}}", out.V{"error": err})
@ -1022,6 +1018,10 @@ func getKubernetesVersion(old *config.ClusterConfig) string {
} }
} }
if old == nil || old.KubernetesConfig.KubernetesVersion == "" {
return nv
}
ovs, err := semver.Make(strings.TrimPrefix(old.KubernetesConfig.KubernetesVersion, version.VersionPrefix)) ovs, err := semver.Make(strings.TrimPrefix(old.KubernetesConfig.KubernetesVersion, version.VersionPrefix))
if err != nil { if err != nil {
glog.Errorf("Error parsing old version %q: %v", old.KubernetesConfig.KubernetesVersion, err) glog.Errorf("Error parsing old version %q: %v", old.KubernetesConfig.KubernetesVersion, err)