Currently, no warn or exit are there even if user specifies

any version newer than newestKubernetesVersion.
This fixes the flow as follows:
if not --force:
- Warn but do NOT exit for newer minor version and patch version
- Warn and Exit for newer major version

if --force: Warn but try anyways
pull/13354/head
nishipy 2022-01-30 07:27:23 -05:00
parent dc1b226562
commit 9da7049f8a
1 changed files with 10 additions and 7 deletions

View File

@ -1533,6 +1533,16 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
klog.Infof("No Kuberentes version set for minikube, setting Kubernetes version to %s", constants.NoKubernetesVersion)
return
}
if nvs.Major > newestVersion.Major {
out.WarningT("Specified Major version of Kubernetes {{.specifiedMajor}} is newer than the newest supported Major version: {{.newestMajor}}", out.V{"specifiedMajor": nvs.Major, "newestMajor": newestVersion.Major})
if !viper.GetBool(force) {
out.WarningT("You can force an unsupported Kubernetes version via the --force flag")
}
exitIfNotForced(reason.KubernetesTooNew, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
}
if nvs.GT(newestVersion) {
out.WarningT("Specified Kubernetes version {{.specified}} is newer than the newest supported version: {{.newest}}", out.V{"specified": nvs, "newest": constants.NewestKubernetesVersion})
}
if nvs.LT(oldestVersion) {
out.WarningT("Specified Kubernetes version {{.specified}} is less than the oldest supported version: {{.oldest}}", out.V{"specified": nvs, "oldest": constants.OldestKubernetesVersion})
if !viper.GetBool(force) {
@ -1540,13 +1550,6 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
}
exitIfNotForced(reason.KubernetesTooOld, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
}
if nvs.GT(newestVersion) {
out.WarningT("Specified Kubernetes version {{.specified}} is newer than the newest supported version: {{.newest}}", out.V{"specified": nvs, "newest": constants.NewestKubernetesVersion})
if !viper.GetBool(force) {
out.WarningT("You can force an unsupported Kubernetes version via the --force flag if it exists")
}
exitIfNotForced(reason.KubernetesTooNew, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
}
// If the version of Kubernetes has a known issue, print a warning out to the screen
if issue := reason.ProblematicK8sVersion(nvs); issue != nil {