Skip to content

Commit

Permalink
Fixed error parsing old version "latest" or "stable"
Browse files Browse the repository at this point in the history
Fixes kubernetes#8210

Signed-off-by: kadern0 <[email protected]>
  • Loading branch information
kadern0 committed May 21, 2020
1 parent d734118 commit 58dd54a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 58dd54a

Please sign in to comment.