You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/20 04:22:07 UTC

[GitHub] [skywalking-infra-e2e] mrproliu commented on a change in pull request #56: Enhance `KinD` environment

mrproliu commented on a change in pull request #56:
URL: https://github.com/apache/skywalking-infra-e2e/pull/56#discussion_r732404170



##########
File path: internal/components/setup/kind.go
##########
@@ -19,36 +19,67 @@
 package setup
 
 import (
+	"bufio"
+	"bytes"
+	"context"
 	"fmt"
+	"io/ioutil"
+	"net/http"
 	"os"
+	"os/signal"
+	"strconv"
 	"strings"
+	"syscall"
+	"time"
 
+	apiv1 "k8s.io/api/admission/v1"
+	v1 "k8s.io/api/core/v1"
+	"k8s.io/apimachinery/pkg/runtime"
+	"k8s.io/apimachinery/pkg/runtime/schema"
 	"k8s.io/cli-runtime/pkg/genericclioptions"
+	"k8s.io/cli-runtime/pkg/resource"
 	"k8s.io/client-go/dynamic"
 	"k8s.io/client-go/kubernetes"
+	"k8s.io/client-go/rest"
+	"k8s.io/client-go/tools/portforward"
+	"k8s.io/client-go/transport/spdy"
 	ctlwait "k8s.io/kubectl/pkg/cmd/wait"
-
-	"github.com/apache/skywalking-infra-e2e/internal/config"
-
-	apiv1 "k8s.io/api/admission/v1"
-
-	"github.com/apache/skywalking-infra-e2e/internal/util"
+	"k8s.io/kubectl/pkg/polymorphichelpers"
+	"k8s.io/kubectl/pkg/scheme"
+	ctlutil "k8s.io/kubectl/pkg/util"
 
 	kind "sigs.k8s.io/kind/cmd/kind/app"
 	kindcmd "sigs.k8s.io/kind/pkg/cmd"
 
+	"github.com/apache/skywalking-infra-e2e/internal/config"
 	"github.com/apache/skywalking-infra-e2e/internal/constant"
-
 	"github.com/apache/skywalking-infra-e2e/internal/logger"
+	"github.com/apache/skywalking-infra-e2e/internal/util"
 )
 
 var (
 	kindConfigPath string
 	kubeConfigPath string
+
+	portForwardContext *kindPortForwardContext
 )
 
+type kindPortForwardContext struct {
+	ctx                     context.Context
+	cancelFunc              context.CancelFunc
+	stopChannel             chan struct{}
+	resourceCount           int
+	resourceFinishedChannel chan struct{}
+}
+
+type kindPort struct {
+	inputPort  string // User input port
+	realPort   int    // Real remote port, deference with input when resource is service or use port name
+	waitExpose string // Need to use when expose
+}
+
 // KindSetup sets up environment according to e2e.yaml.
-func KindSetup(e2eConfig *config.E2EConfig) error {
+func KindSetup(e2eConfig *config.E2EConfig, useCommand string) error {

Review comment:
       I see. When I add `useCommand` arguments to `KindSetup`, I already have trying to refer to the `trigger` component, but they sharing to use `DoSetupAccordingE2E` method between `run`/`setup`, also only `KinD` environment need to wait, so I add this argument to let `KinD` component to decide should wait.
   
   I'll follow your comment way to fix it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org