Skip to content

Commit

Permalink
ensure that 'crio' is used for k8s config
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-b committed Jun 29, 2020
1 parent 9bcc587 commit 56fa2b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 56fa2b9

Please sign in to comment.