Exit if both no-kubernetes and kubernetes-version flags are used together.

pull/12942/head
klaases 2021-11-16 15:53:32 -08:00
parent 38358b9b63
commit 227efdd03a
1 changed files with 5 additions and 1 deletions

View File

@ -1541,11 +1541,15 @@ func isBaseImageApplicable(drv string) bool {
func getKubernetesVersion(old *config.ClusterConfig) string {
if viper.GetBool(noKubernetes) {
// Exit if --kubernetes-version is specified.
if viper.GetString(kubernetesVersion) != "" {
exit.Message(reason.Usage, "cannot specify --kubernetes-version with --no-kubernetes")
}
klog.Infof("No Kubernetes flag is set, setting Kubernetes version to %s", constants.NoKubernetesVersion)
if old != nil {
old.KubernetesConfig.KubernetesVersion = constants.NoKubernetesVersion
}
return viper.GetString(constants.NoKubernetesVersion)
}
paramVersion := viper.GetString(kubernetesVersion)