Merge pull request #13787 from zhan9san/feature/use-image-tag
Load image from cache and retrieve sha value from registrypull/14294/head
commit
0184ff7cf2
|
@ -136,6 +136,7 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
|
|||
}()
|
||||
for _, img := range append([]string{baseImg}, kic.FallbackImages...) {
|
||||
var err error
|
||||
var isFromCache bool
|
||||
|
||||
if driver.IsDocker(cc.Driver) && download.ImageExistsInDaemon(img) && !downloadOnly {
|
||||
klog.Infof("%s exists in daemon, skipping load", img)
|
||||
|
@ -161,20 +162,21 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
|
|||
err = download.CacheToDaemon(img)
|
||||
if err == nil {
|
||||
klog.Infof("successfully loaded %s from cached tarball", img)
|
||||
finalImg = img
|
||||
return nil
|
||||
isFromCache = true
|
||||
}
|
||||
}
|
||||
|
||||
if driver.IsDocker(cc.Driver) {
|
||||
klog.Infof("failed to load %s, will try remote image if available: %v", img, err)
|
||||
|
||||
klog.Infof("Downloading %s to local daemon", img)
|
||||
err = download.ImageToDaemon(img)
|
||||
if err == nil {
|
||||
klog.Infof("successfully downloaded %s", img)
|
||||
finalImg = img
|
||||
return nil
|
||||
} else if isFromCache {
|
||||
klog.Infof("use image loaded from cache %s", strings.Split(img, "@")[0])
|
||||
finalImg = strings.Split(img, "@")[0]
|
||||
return nil
|
||||
}
|
||||
}
|
||||
klog.Infof("failed to download %s, will try fallback image if available: %v", img, err)
|
||||
|
|
Loading…
Reference in New Issue