未验证 提交 1924610c 编写于 作者: T Thomas Strömberg 提交者: GitHub

Merge pull request #4141 from tstromberg/download-iso-first3

Download ISO image before Docker images, as it's required first
......@@ -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)
}
......
......@@ -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")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册