Skip to content

Commit

Permalink
Merge pull request #4141 from tstromberg/download-iso-first3
Browse files Browse the repository at this point in the history
Download ISO image before Docker images, as it's required first
  • Loading branch information
tstromberg authored Apr 23, 2019
2 parents 5e8160b + a163706 commit 1924610
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 9 additions & 5 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1924610

Please sign in to comment.