From 5b39275f5b37a89b454225bd42d057695fba1238 Mon Sep 17 00:00:00 2001 From: naison <895703375@qq.com> Date: Fri, 21 Feb 2025 14:39:21 +0000 Subject: [PATCH] hotfix: default use spdy not websocket to portforward --- pkg/util/pod.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/util/pod.go b/pkg/util/pod.go index f3cc32fc..56a24c5c 100644 --- a/pkg/util/pod.go +++ b/pkg/util/pod.go @@ -146,10 +146,6 @@ func WaitPod(ctx context.Context, podInterface v12.PodInterface, list v1.ListOpt } func PortForwardPod(config *rest.Config, clientset *rest.RESTClient, podName, namespace string, portPair []string, readyChan chan struct{}, stopChan <-chan struct{}, out, errOut io.Writer) error { - err := os.Setenv(string(util.RemoteCommandWebsockets), "true") - if err != nil { - return err - } url := clientset. Post(). Resource("pods"). @@ -226,10 +222,6 @@ func GetTopOwnerReferenceBySelector(factory util.Factory, ns, selector string) ( } func Shell(_ context.Context, clientset *kubernetes.Clientset, config *rest.Config, podName, containerName, ns string, cmd []string) (string, error) { - err := os.Setenv(string(util.RemoteCommandWebsockets), "true") - if err != nil { - return "", err - } stdin, _, _ := term.StdStreams() buf := bytes.NewBuffer(nil) options := exec.ExecOptions{ @@ -247,10 +239,10 @@ func Shell(_ context.Context, clientset *kubernetes.Clientset, config *rest.Conf PodClient: clientset.CoreV1(), Config: config, } - if err = options.Run(); err != nil { + if err := options.Run(); err != nil { return "", err } - return strings.TrimRight(buf.String(), "\n"), err + return strings.TrimRight(buf.String(), "\n"), nil } func WaitPodToBeReady(ctx context.Context, podInterface v12.PodInterface, selector v1.LabelSelector) error {