From 3db7e9e252b8fab17e2046b6e3d8bb53377118c5 Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Thu, 4 Apr 2019 23:01:10 -0300 Subject: [PATCH 1/5] Don't cache images when --vmdriver=none --- cmd/minikube/cmd/start.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index df661362d08a..daaf627a25f1 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -135,7 +135,7 @@ func init() { startCmd.Flags().String(networkPlugin, "", "The name of the network plugin") startCmd.Flags().Bool(enableDefaultCNI, false, "Enable the default CNI plugin (/etc/cni/net.d/k8s.conf). Used in conjunction with \"--network-plugin=cni\"") startCmd.Flags().String(featureGates, "", "A set of key=value pairs that describe feature gates for alpha/experimental features.") - startCmd.Flags().Bool(cacheImages, true, "If true, cache docker images for the current bootstrapper and load them into the machine.") + startCmd.Flags().Bool(cacheImages, true, "If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --vm-driver=none.") startCmd.Flags().Var(&extraOptions, "extra-config", `A set of key=value pairs that describe configuration that may be passed to different components. The key should be '.' separated, and the first part before the dot is the component to apply the configuration to. @@ -174,6 +174,11 @@ func runStart(cmd *cobra.Command, args []string) { exit.WithError("Failed to generate config", err) } + if viper.GetString(vmDriver) == constants.DriverNone { + console.OutStyle("starting-none", "Caching of container images is disabled when --vm-driver=none") + viper.Set(cacheImages, false) + } + var cacheGroup errgroup.Group beginCacheImages(&cacheGroup, k8sVersion) From 9bc73ebbaf495704d0c491a9318de54998264929 Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Fri, 5 Apr 2019 08:36:45 -0300 Subject: [PATCH 2/5] code comments --- cmd/minikube/cmd/start.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index daaf627a25f1..a1695fd3b683 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -175,6 +175,18 @@ func runStart(cmd *cobra.Command, args []string) { } if viper.GetString(vmDriver) == constants.DriverNone { + /* + Caching images means: + - minikube download the images + - minikube saves them in ~/.minikube/cache + - minikube loads them to the host machine with `docker load -i ~/.minikube/cache/some_images` + + This makes complete sense, except that when --vm-driver=none, the host machine is the local machine. + That means once the images is loaded into docker, it stays there even after reboots and `minikube delete`. + That means they are already cached and nothing needs to be done. Not only that, loading the container with + `docker load -i ~/.minikube/cache/some_images` is unecessary and takes time. + As a bonus, we save disk space. + */ console.OutStyle("starting-none", "Caching of container images is disabled when --vm-driver=none") viper.Set(cacheImages, false) } From 3deee6322b7cb7ab41886be840da3ca196331751 Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Sat, 6 Apr 2019 07:23:16 -0300 Subject: [PATCH 3/5] removed line as requested --- cmd/minikube/cmd/start.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index a1695fd3b683..91d628a55b65 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -187,7 +187,6 @@ func runStart(cmd *cobra.Command, args []string) { `docker load -i ~/.minikube/cache/some_images` is unecessary and takes time. As a bonus, we save disk space. */ - console.OutStyle("starting-none", "Caching of container images is disabled when --vm-driver=none") viper.Set(cacheImages, false) } From 2a826b14df894c3931894bf7b4075ca9177f1b1d Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Wed, 10 Apr 2019 15:22:12 -0300 Subject: [PATCH 4/5] shorter comment --- cmd/minikube/cmd/start.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 91d628a55b65..8430af42973d 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -175,18 +175,7 @@ func runStart(cmd *cobra.Command, args []string) { } if viper.GetString(vmDriver) == constants.DriverNone { - /* - Caching images means: - - minikube download the images - - minikube saves them in ~/.minikube/cache - - minikube loads them to the host machine with `docker load -i ~/.minikube/cache/some_images` - - This makes complete sense, except that when --vm-driver=none, the host machine is the local machine. - That means once the images is loaded into docker, it stays there even after reboots and `minikube delete`. - That means they are already cached and nothing needs to be done. Not only that, loading the container with - `docker load -i ~/.minikube/cache/some_images` is unecessary and takes time. - As a bonus, we save disk space. - */ + // Optimization: images will be persistently loaded into host Docker, so no need to duplicate work. viper.Set(cacheImages, false) } From 8f5fe19722469e735fdc7175e2628addcf97833d Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Wed, 10 Apr 2019 15:24:04 -0300 Subject: [PATCH 5/5] politically correct comment --- cmd/minikube/cmd/start.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 8430af42973d..a329f8c2b44b 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -175,7 +175,7 @@ func runStart(cmd *cobra.Command, args []string) { } if viper.GetString(vmDriver) == constants.DriverNone { - // Optimization: images will be persistently loaded into host Docker, so no need to duplicate work. + // Optimization: images will be persistently loaded into the host's container runtime, so no need to duplicate work. viper.Set(cacheImages, false) }