diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index f3ba1300b65759f8552b7ea212853a39c71ea6c8..137d3308fd338da61aab744b67dedb6416dcf68f 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -176,11 +176,17 @@ func runStart(cmd *cobra.Command, args []string) { exit.WithError("Failed to generate config", err) } - if viper.GetString(vmDriver) == constants.DriverNone { - // Optimization: images will be persistently loaded into the host's container runtime, so no need to duplicate work. + // For non-"none", the ISO is required to boot, so block until it is downloaded + if viper.GetString(vmDriver) != constants.DriverNone { + if err := cluster.CacheISO(config.MachineConfig); err != nil { + exit.WithError("Failed to cache ISO", err) + } + } else { + // With "none", images are persistently stored in Docker, so internal caching isn't necessary. viper.Set(cacheImages, false) } + // Now that the ISO is downloaded, pull images in the background while the VM boots. var cacheGroup errgroup.Group beginCacheImages(&cacheGroup, k8sVersion) @@ -195,10 +201,8 @@ func runStart(cmd *cobra.Command, args []string) { exit.WithError("Failed to get machine client", err) } + // If --download-only, complete the remaining downloads and exit. if viper.GetBool(downloadOnly) { - if err := cluster.CacheISO(config.MachineConfig); err != nil { - exit.WithError("Failed to cache ISO", err) - } if err := doCacheBinaries(k8sVersion); err != nil { exit.WithError("Failed to cache binaries", err) } diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index 96bc3740e83e37bc1bf2f1ee6194ad758f56cf3d..a8c799e5db397eb05949fcacceea05cf9fa103bc 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -301,13 +301,7 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error exit.WithError("error getting driver", err) } - err = CacheISO(config) - if err != nil { - return nil, errors.Wrap(err, "unable to cache ISO") - } - driver := def.ConfigCreator(config) - data, err := json.Marshal(driver) if err != nil { return nil, errors.Wrap(err, "marshal")