Skip to content

Commit c590592

Browse files
ComradeProgrammermedyagh
authored andcommitted
fix: fix incorrect finalImg in cache.go
1 parent e85d6ef commit c590592

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

pkg/minikube/download/image.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,11 @@ func ImageToCache(img string) error {
226226
}
227227
}
228228

229-
// GHImageTarballToCache try to download the tarball of kicbase from github release.
229+
// GHKicbaseTarballToCache try to download the tarball of kicbase from github release.
230230
// This is the last resort, in case of all docker registry is not available.
231-
func GHImageTarballToCache(img, imgVersion string) (string, error) {
232-
f := imagePathInCache(img)
231+
func GHKicbaseTarballToCache(kicBaseVersion string) (string, error) {
232+
imageName := fmt.Sprintf("kicbase/stable:%s", kicBaseVersion)
233+
f := imagePathInCache(imageName)
233234
fileLock := f + ".lock"
234235

235236
kicbaseArch := runtime.GOARCH
@@ -244,9 +245,9 @@ func GHImageTarballToCache(img, imgVersion string) (string, error) {
244245
if releaser != nil {
245246
defer releaser.Release()
246247
}
247-
downloadURL := fmt.Sprintf("https://github.com/kubernetes/minikube/releases/download/%s/%s-%s-%s.tar",
248+
downloadURL := fmt.Sprintf("https://github.com/kubernetes/minikube/releases/download/%s/kicbase-%s-%s.tar",
248249
version.GetVersion(),
249-
img, imgVersion, kicbaseArch)
250+
kicBaseVersion, kicbaseArch)
250251

251252
// we don't want the tarball to be decompressed
252253
// so we pass client options to suppress this behavior

pkg/minikube/node/cache.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,18 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
188188
out.Ln("")
189189

190190
kicbaseVersion := strings.Split(kic.Version, "-")[0]
191-
finalImg, err = download.GHImageTarballToCache("kicbase", kicbaseVersion)
191+
_, err = download.GHKicbaseTarballToCache(kicbaseVersion)
192192
if err != nil {
193-
klog.Infof("failed to download %s", finalImg)
193+
klog.Infof("failed to download kicbase from github")
194194
return fmt.Errorf("failed to download kic base image or any fallback image")
195195
}
196-
klog.Infof("successfully downloaded %s as fall back image", finalImg)
196+
197+
klog.Infof("successfully downloaded kicbase as fall back image from github")
197198
if !downloadOnly && driver.IsDocker(cc.Driver) {
198-
if finalImg, err = download.CacheToDaemon("kicbase"); err == nil {
199+
if finalImg, err = download.CacheToDaemon(fmt.Sprintf("kicbase/stable:%s", kicbaseVersion)); err == nil {
199200
klog.Infof("successfully loaded and using kicbase from tarball on github")
201+
} else {
202+
return fmt.Errorf("failed to load kic base image into docker: %v", err)
200203
}
201204
}
202205
return nil

0 commit comments

Comments
 (0)