diff --git a/pkg/minikube/machine/cache_images.go b/pkg/minikube/machine/cache_images.go index 862bd918c317..4aab4766574c 100644 --- a/pkg/minikube/machine/cache_images.go +++ b/pkg/minikube/machine/cache_images.go @@ -118,7 +118,7 @@ func LoadCachedImages(cc *config.ClusterConfig, runner command.Runner, images [] }) } if err := g.Wait(); err != nil { - return errors.Wrap(err, "loading cached images") + return errors.Wrap(err, "LoadCachedImages") } klog.Infoln("Successfully loaded all cached images") return nil @@ -223,7 +223,6 @@ func DoLoadImages(images []string, profiles []*config.Profile, cacheDir string, for _, n := range c.Nodes { m := config.MachineName(*c, n) - status, err := Status(api, m) if err != nil { klog.Warningf("error getting status for %s: %v", m, err) @@ -251,7 +250,7 @@ func DoLoadImages(images []string, profiles []*config.Profile, cacheDir string, } if err != nil { failed = append(failed, m) - klog.Warningf("Failed to load cached images for profile %s. make sure the profile is running. %v", pName, err) + klog.Warningf("Failed to load cached images for %q: %v", pName, err) continue } succeeded = append(succeeded, m) @@ -259,8 +258,12 @@ func DoLoadImages(images []string, profiles []*config.Profile, cacheDir string, } } - klog.Infof("succeeded pushing to: %s", strings.Join(succeeded, " ")) - klog.Infof("failed pushing to: %s", strings.Join(failed, " ")) + if len(succeeded) > 0 { + klog.Infof("succeeded pushing to: %s", strings.Join(succeeded, " ")) + } + if len(failed) > 0 { + klog.Infof("failed pushing to: %s", strings.Join(failed, " ")) + } // Live pushes are not considered a failure return nil } @@ -309,6 +312,9 @@ func transferAndLoadImage(cr command.Runner, k8s config.KubernetesConfig, src st err = r.LoadImage(dst) if err != nil { + if strings.Contains(err.Error(), "ctr: image might be filtered out") { + out.WarningT("The image '{{.imageName}}' does not match arch of the container runtime, use a multi-arch image instead", out.V{"imageName": imgName}) + } return errors.Wrapf(err, "%s load %s", r.Name(), dst) } diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index fd50dadc4d07..fbcc05fece33 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -57,7 +57,7 @@ import ( "golang.org/x/build/kubernetes/api" ) -const addonResizer = "gcr.io/google-containers/addon-resizer" +const echoServerImg = "gcr.io/k8s-minikube/kicbase-builds/echo-server" // validateFunc are for subtests that share a single setup type validateFunc func(context.Context, *testing.T, string) @@ -182,10 +182,10 @@ func cleanupUnwantedImages(ctx context.Context, t *testing.T, profile string) { if err != nil { t.Skipf("docker is not installed, cannot delete docker images") } else { - t.Run("delete addon-resizer images", func(t *testing.T) { - tags := []string{"1.8.8", profile} + t.Run("delete echo-server images", func(t *testing.T) { + tags := []string{"1.0", profile} for _, tag := range tags { - image := fmt.Sprintf("%s:%s", addonResizer, tag) + image := fmt.Sprintf("%s:%s", echoServerImg, tag) rr, err := Run(t, exec.CommandContext(ctx, "docker", "rmi", "-f", image)) if err != nil { t.Logf("failed to remove image %q from docker images. args %q: %v", image, rr.Command(), err) @@ -230,7 +230,7 @@ func validateNodeLabels(ctx context.Context, t *testing.T, profile string) { // tagAndLoadImage is a helper function to pull, tag, load image (decreases cyclomatic complexity for linter). func tagAndLoadImage(ctx context.Context, t *testing.T, profile, taggedImage string) { - newPulledImage := fmt.Sprintf("%s:%s", addonResizer, "1.8.9") + newPulledImage := fmt.Sprintf("%s:%s", echoServerImg, "1.8.9") rr, err := Run(t, exec.CommandContext(ctx, "docker", "pull", newPulledImage)) if err != nil { t.Fatalf("failed to setup test (pull image): %v\n%s", err, rr.Output()) @@ -325,8 +325,8 @@ func validateImageCommands(ctx context.Context, t *testing.T, profile string) { checkImageExists(ctx, t, profile, newImage) }) - taggedImage := fmt.Sprintf("%s:%s", addonResizer, profile) - imageFile := "addon-resizer-save.tar" + taggedImage := fmt.Sprintf("%s:%s", echoServerImg, profile) + imageFile := "echo-server-save.tar" var imagePath string defer os.Remove(imageFile) @@ -337,7 +337,7 @@ func validateImageCommands(ctx context.Context, t *testing.T, profile string) { t.Fatalf("failed to get absolute path of file %q: %v", imageFile, err) } - pulledImage := fmt.Sprintf("%s:%s", addonResizer, "1.8.8") + pulledImage := fmt.Sprintf("%s:%s", echoServerImg, "2.0") rr, err := Run(t, exec.CommandContext(ctx, "docker", "pull", pulledImage)) if err != nil { t.Fatalf("failed to setup test (pull image): %v\n%s", err, rr.Output())