未验证 提交 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) { ...@@ -176,11 +176,17 @@ func runStart(cmd *cobra.Command, args []string) {
exit.WithError("Failed to generate config", err) exit.WithError("Failed to generate config", err)
} }
if viper.GetString(vmDriver) == constants.DriverNone { // For non-"none", the ISO is required to boot, so block until it is downloaded
// Optimization: images will be persistently loaded into the host's container runtime, so no need to duplicate work. 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) viper.Set(cacheImages, false)
} }
// Now that the ISO is downloaded, pull images in the background while the VM boots.
var cacheGroup errgroup.Group var cacheGroup errgroup.Group
beginCacheImages(&cacheGroup, k8sVersion) beginCacheImages(&cacheGroup, k8sVersion)
...@@ -195,10 +201,8 @@ func runStart(cmd *cobra.Command, args []string) { ...@@ -195,10 +201,8 @@ func runStart(cmd *cobra.Command, args []string) {
exit.WithError("Failed to get machine client", err) exit.WithError("Failed to get machine client", err)
} }
// If --download-only, complete the remaining downloads and exit.
if viper.GetBool(downloadOnly) { 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 { if err := doCacheBinaries(k8sVersion); err != nil {
exit.WithError("Failed to cache binaries", err) exit.WithError("Failed to cache binaries", err)
} }
......
...@@ -301,13 +301,7 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error ...@@ -301,13 +301,7 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error
exit.WithError("error getting driver", err) 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) driver := def.ConfigCreator(config)
data, err := json.Marshal(driver) data, err := json.Marshal(driver)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "marshal") return nil, errors.Wrap(err, "marshal")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册