make a default container runtime constant so that it is easy to change in the future

pull/10223/head
Priya Wadhwa 2021-01-22 14:00:47 -08:00
parent 81d637cd01
commit b2623d4d4e
3 changed files with 5 additions and 2 deletions

View File

@ -142,7 +142,7 @@ func initMinikubeFlags() {
startCmd.Flags().String(kicBaseImage, kic.BaseImage, "The base image to use for docker/podman drivers. Intended for local development.")
startCmd.Flags().Bool(keepContext, false, "This will keep the existing kubectl context and will create a minikube context.")
startCmd.Flags().Bool(embedCerts, false, "if true, will embed the certs in kubeconfig.")
startCmd.Flags().String(containerRuntime, "docker", fmt.Sprintf("The container runtime to be used (%s).", strings.Join(cruntime.ValidRuntimes(), ", ")))
startCmd.Flags().String(containerRuntime, constants.DefaultContainerRuntime, fmt.Sprintf("The container runtime to be used (%s).", strings.Join(cruntime.ValidRuntimes(), ", ")))
startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube.")
startCmd.Flags().String(mountString, constants.DefaultMountDir+":/minikube-host", "The argument to pass the minikube mount command on start.")
startCmd.Flags().StringSliceVar(&config.AddonList, "addons", nil, "Enable addons. see `minikube addons list` for a list of valid addon names.")

View File

@ -45,6 +45,8 @@ const (
RegistryAddonPort = 5000
// CRIO is the default name and spelling for the cri-o container runtime
CRIO = "crio"
// DefaultContainerRuntime is our default container runtime
DefaultContainerRuntime = "docker"
// APIServerName is the default API server name
APIServerName = "minikubeCA"

View File

@ -27,6 +27,7 @@ import (
"testing"
"time"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/driver"
)
@ -133,7 +134,7 @@ func KicDriver() bool {
func ContainerRuntime() string {
flag := "--container-runtime="
if !strings.Contains(*startArgs, flag) {
return "docker"
return constants.DefaultContainerRuntime
}
for _, s := range StartArgs() {
if strings.HasPrefix(s, flag) {