From 58dd54a1f2c2338ab717a366244c79274bbf2621 Mon Sep 17 00:00:00 2001 From: kadern0 Date: Thu, 21 May 2020 19:51:36 +1000 Subject: [PATCH] Fixed error parsing old version "latest" or "stable" Fixes #8210 Signed-off-by: kadern0 --- cmd/minikube/cmd/start_flags.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index 5b768a526702..c6b5eb7ac12c 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -249,9 +249,9 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k selectedEnableDefaultCNI = true } } - repository := viper.GetString(imageRepository) mirrorCountry := strings.ToLower(viper.GetString(imageMirrorCountry)) + if strings.ToLower(repository) == "auto" || mirrorCountry != "" { found, autoSelectedRepository, err := selectImageRepository(mirrorCountry, semver.MustParse(strings.TrimPrefix(k8sVersion, version.VersionPrefix))) if err != nil { @@ -471,7 +471,14 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC } if cmd.Flags().Changed(kubernetesVersion) { - existing.KubernetesConfig.KubernetesVersion = viper.GetString(kubernetesVersion) + switch viper.GetString(kubernetesVersion) { + case "latest": + existing.KubernetesConfig.KubernetesVersion = constants.NewestKubernetesVersion + case "stable": + existing.KubernetesConfig.KubernetesVersion = constants.DefaultKubernetesVersion + default: + existing.KubernetesConfig.KubernetesVersion = viper.GetString(kubernetesVersion) + } } if cmd.Flags().Changed(apiServerName) {