From b2623d4d4e844a3f224010faa0908ee30fc70a45 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Fri, 22 Jan 2021 14:00:47 -0800 Subject: [PATCH] make a default container runtime constant so that it is easy to change in the future --- cmd/minikube/cmd/start_flags.go | 2 +- pkg/minikube/constants/constants.go | 2 ++ test/integration/main_test.go | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index 510e9a685f..3f0bca586e 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -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.") diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index f7d2aa6e68..21bcbc613c 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -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" diff --git a/test/integration/main_test.go b/test/integration/main_test.go index 9a108ba862..8fb2c269a0 100644 --- a/test/integration/main_test.go +++ b/test/integration/main_test.go @@ -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) {