Skip to content

Commit 6097934

Browse files
committed
kicbase: simplify the image loading logic
This change refactors beginDownloadKicBaseImage() a bit to achieve a more streamlined flow of logic, combining redundant blocks. In the special case of podman, it leaves image loading from cache loading from cache unimplemented and removes the confusing and unhelpful message. Signed-off-by: Michael Adam <[email protected]>
1 parent 6d351f1 commit 6097934

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

pkg/minikube/node/cache.go

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,22 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
154154
var err error
155155
for _, img := range append([]string{baseImg}, kic.FallbackImages...) {
156156

157-
if driver.IsDocker(cc.Driver) && download.ImageExistsInDaemon(img) && !downloadOnly {
158-
klog.Infof("%s exists in daemon, skipping load", img)
159-
finalImg = img
160-
return nil
161-
}
157+
if driver.IsDocker(cc.Driver) {
158+
if download.ImageExistsInDaemon(img) {
159+
klog.Infof("%s exists in daemon, skipping load", img)
160+
finalImg = img
161+
return nil
162+
}
162163

163-
klog.Infof("Downloading %s to local cache", img)
164-
err = download.ImageToCache(img)
165-
if err == nil {
166-
klog.Infof("successfully saved %s as a tarball", img)
167-
}
168-
if downloadOnly && err == nil {
169-
return nil
170-
}
164+
klog.Infof("Downloading %s to local cache", img)
165+
err = download.ImageToCache(img)
166+
if err == nil {
167+
klog.Infof("successfully saved %s as a tarball", img)
168+
}
169+
if downloadOnly {
170+
return nil
171+
}
171172

172-
if cc.Driver == driver.Podman {
173-
return fmt.Errorf("not yet implemented, see issue #8426")
174-
}
175-
if driver.IsDocker(cc.Driver) && err == nil {
176173
klog.Infof("Loading %s from local cache", img)
177174
if finalImg, err = download.CacheToDaemon(img); err == nil {
178175
klog.Infof("successfully loaded and using %s from cached tarball", img)

0 commit comments

Comments
 (0)