You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/02/17 16:36:19 UTC

[skywalking-infra-e2e] 01/01: Revert "Automatically pull images before loading into KinD (#10397) (#101)"

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch revert-101-feature/support-pull-image
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git

commit 3ae52b49969682381de2c98d1ab7e62e0d4eb0bb
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Sat Feb 18 00:36:13 2023 +0800

    Revert "Automatically pull images before loading into KinD (#10397) (#101)"
    
    This reverts commit f13a7e4d3122a67ee9a643d478421083893e2e85.
---
 internal/components/setup/kind.go | 42 +--------------------------------------
 1 file changed, 1 insertion(+), 41 deletions(-)

diff --git a/internal/components/setup/kind.go b/internal/components/setup/kind.go
index 2ab9923..4fe24a4 100644
--- a/internal/components/setup/kind.go
+++ b/internal/components/setup/kind.go
@@ -22,7 +22,6 @@ import (
 	"bufio"
 	"bytes"
 	"context"
-	"errors"
 	"fmt"
 	"net/http"
 	"os"
@@ -30,7 +29,6 @@ import (
 	"strconv"
 	"strings"
 	"sync"
-	"sync/atomic"
 	"time"
 
 	apiv1 "k8s.io/api/admission/v1"
@@ -47,8 +45,6 @@ import (
 	"k8s.io/kubectl/pkg/scheme"
 	ctlutil "k8s.io/kubectl/pkg/util"
 
-	"github.com/docker/docker/api/types"
-	docker "github.com/docker/docker/client"
 	kind "sigs.k8s.io/kind/cmd/kind/app"
 	kindcmd "sigs.k8s.io/kind/pkg/cmd"
 
@@ -77,39 +73,8 @@ type kindPort struct {
 	waitExpose string // Need to use when expose
 }
 
-// pullImages pull docker images from remote before loading them into KinD cluster
-func pullImages(images []string) error {
-	cli, err := docker.NewClientWithOpts(docker.FromEnv)
-	if err != nil {
-		return err
-	}
-	defer cli.Close()
-
-	var count int32
-	var wg sync.WaitGroup
-	for _, image := range images {
-		wg.Add(1)
-		go func(image string) {
-			defer wg.Done()
-			out, err := cli.ImagePull(context.Background(), image, types.ImagePullOptions{})
-			if err != nil {
-				logger.Log.Error("pull image error", "name", image, "error", err)
-				return
-			}
-			atomic.AddInt32(&count, 1)
-			out.Close()
-		}(image)
-	}
-	wg.Wait()
-	if int(count) != len(images) {
-		return errors.New("can not pull all images")
-	}
-	return nil
-}
-
-// KindSetup sets up environment according to e2e.yaml.
-//
 //nolint:gocyclo // skip the cyclomatic complexity check here
+// KindSetup sets up environment according to e2e.yaml.
 func KindSetup(e2eConfig *config.E2EConfig) error {
 	kindConfigPath = e2eConfig.Setup.GetFile()
 
@@ -152,11 +117,6 @@ func KindSetup(e2eConfig *config.E2EConfig) error {
 
 	// import images
 	if len(e2eConfig.Setup.Kind.ImportImages) > 0 {
-		// pull images if this image not exist
-		if err := pullImages(e2eConfig.Setup.Kind.ImportImages); err != nil {
-			return err
-		}
-
 		for _, image := range e2eConfig.Setup.Kind.ImportImages {
 			image = os.ExpandEnv(image)
 			args := []string{"load", "docker-image", image}