From 22edb6f063bac7503aba622686ec4ce800a13ebb Mon Sep 17 00:00:00 2001 From: niedhui Date: Thu, 30 Jul 2020 14:34:13 +0800 Subject: [PATCH] make baseImage respect imageRepo Signed-off-by: niedhui --- pkg/minikube/node/cache.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/minikube/node/cache.go b/pkg/minikube/node/cache.go index 711408646769..1ca70e0ab715 100644 --- a/pkg/minikube/node/cache.go +++ b/pkg/minikube/node/cache.go @@ -117,16 +117,19 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down glog.Infof("Beginning downloading kic base image for %s with %s", cc.Driver, cc.KubernetesConfig.ContainerRuntime) out.T(out.Pulling, "Pulling base image ...") g.Go(func() error { - // TODO #8004 : make base-image respect --image-repository + baseImg := cc.KicBaseImage + if baseImg == kic.BaseImage && len(cc.KubernetesConfig.ImageRepository) != 0 { + baseImg = strings.Replace(baseImg, "gcr.io/k8s-minikube", cc.KubernetesConfig.ImageRepository, 1) + } var finalImg string // If we end up using a fallback image, notify the user defer func() { - if finalImg != "" && finalImg != cc.KicBaseImage { + if finalImg != "" && finalImg != baseImg { out.WarningT(fmt.Sprintf("minikube was unable to download %s, but successfully downloaded %s as a fallback image", image.Tag(cc.KicBaseImage), image.Tag(finalImg))) cc.KicBaseImage = finalImg } }() - for _, img := range append([]string{cc.KicBaseImage}, kic.FallbackImages...) { + for _, img := range append([]string{baseImg}, kic.FallbackImages...) { if err := image.LoadFromTarball(driver.Docker, img); err == nil { glog.Infof("successfully loaded %s from cached tarball", img) // strip the digest from the img before saving it in the config