From 56fa2b9ffad740ae29769adc2ee17d8134778c03 Mon Sep 17 00:00:00 2001 From: Sunny Beatteay Date: Mon, 29 Jun 2020 19:49:38 -0400 Subject: [PATCH] ensure that 'crio' is used for k8s config --- cmd/minikube/cmd/start.go | 7 ++++++- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 2 +- pkg/minikube/constants/constants.go | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index e7962a7eecdb..38e43316e692 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -859,13 +859,18 @@ func validateFlags(cmd *cobra.Command, drvName string) { validOptions := cruntime.ValidRuntimes() // `crio` is accepted as an alternative spelling to `cri-o` - validOptions = append(validOptions, "crio") + validOptions = append(validOptions, constants.CRIO) var validRuntime bool for _, option := range validOptions { if runtime == option { validRuntime = true } + + // Convert `cri-o` to `crio` as the K8s config uses the `crio` spelling + if runtime == "cri-o" { + viper.Set(containerRuntime, constants.CRIO) + } } if !validRuntime { diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 830344fb4435..dbd4111c364c 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -281,7 +281,7 @@ func (k *Bootstrapper) applyCNI(cfg config.ClusterConfig) error { return errors.Wrap(err, "cni apply") } - if cfg.KubernetesConfig.ContainerRuntime == "crio" { + if cfg.KubernetesConfig.ContainerRuntime == constants.CRIO { if err := cruntime.UpdateCRIONet(k.c, cnm.CIDR()); err != nil { return errors.Wrap(err, "update crio") } diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index ffdb5bad12b6..18a2e1300783 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -42,6 +42,8 @@ const ( SSHPort = 22 // RegistryAddonPort os the default registry addon port RegistryAddonPort = 5000 + // CRIO is the default spelling for the cri-o container runtime + CRIO = "crio" // APIServerName is the default API server name APIServerName = "minikubeCA"