Return NoKubernetesVersion if noKubernetes is true.

pull/12942/head
klaases 2021-11-16 14:24:02 -08:00
parent 609fa0946c
commit 38358b9b63
1 changed files with 3 additions and 4 deletions

View File

@ -1540,17 +1540,16 @@ func isBaseImageApplicable(drv string) bool {
} }
func getKubernetesVersion(old *config.ClusterConfig) string { func getKubernetesVersion(old *config.ClusterConfig) string {
var paramVersion string
if viper.GetBool(noKubernetes) { if viper.GetBool(noKubernetes) {
klog.Infof("No Kubernetes flag is set, setting Kubernetes version to %s", constants.NoKubernetesVersion) klog.Infof("No Kubernetes flag is set, setting Kubernetes version to %s", constants.NoKubernetesVersion)
if old != nil { if old != nil {
old.KubernetesConfig.KubernetesVersion = constants.NoKubernetesVersion old.KubernetesConfig.KubernetesVersion = constants.NoKubernetesVersion
} }
paramVersion = viper.GetString(constants.NoKubernetesVersion) return viper.GetString(constants.NoKubernetesVersion)
} else {
paramVersion = viper.GetString(kubernetesVersion)
} }
paramVersion := viper.GetString(kubernetesVersion)
// try to load the old version first if the user didn't specify anything // try to load the old version first if the user didn't specify anything
if paramVersion == "" && old != nil { if paramVersion == "" && old != nil {
paramVersion = old.KubernetesConfig.KubernetesVersion paramVersion = old.KubernetesConfig.KubernetesVersion