Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/e2e/framework: remove unused function #2020

Merged
merged 1 commit into from Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 0 additions & 36 deletions test/e2e/framework/framework.go
Expand Up @@ -16,11 +16,8 @@ package framework

import (
"bufio"
"bytes"
"context"
"fmt"
"net/http"
"net/url"
"os/exec"
"regexp"
"strconv"
Expand Down Expand Up @@ -52,8 +49,6 @@ import (
schedulingv1client "k8s.io/client-go/kubernetes/typed/scheduling/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/portforward"
"k8s.io/client-go/transport/spdy"
apiservicesclient "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset"
metricsclient "k8s.io/metrics/pkg/client/clientset/versioned"
)
Expand Down Expand Up @@ -522,37 +517,6 @@ func Poll(interval, timeout time.Duration, f func() error) error {
return err
}

// StartPortForward initiates a port forwarding connection to a pod on the localhost interface.
//
// StartPortForward blocks until the port forwarding proxy server is ready to receive connections.
func (f *Framework) StartPortForward(scheme string, name string, ns string, port string) error {
roundTripper, upgrader, err := spdy.RoundTripperFor(f.RestConfig)
if err != nil {
return err
}

path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward", ns, name)
hostIP := strings.TrimLeft(f.RestConfig.Host, "htps:/")
serverURL := url.URL{Scheme: scheme, Path: path, Host: hostIP}
dialer := spdy.NewDialer(upgrader, &http.Client{Transport: roundTripper}, http.MethodPost, &serverURL)

stopChan, readyChan := make(chan struct{}, 1), make(chan struct{}, 1)
out, errOut := new(bytes.Buffer), new(bytes.Buffer)
forwarder, err := portforward.New(dialer, []string{port}, stopChan, readyChan, out, errOut)
if err != nil {
return err
}

go func() {
if err := forwarder.ForwardPorts(); err != nil {
panic(err)
}
}()

<-readyChan
return nil
}

func (f *Framework) CreateOrUpdateAlertmanagerConfig(ctx context.Context, a *v1beta1.AlertmanagerConfig) error {
client := f.MonitoringBetaClient.AlertmanagerConfigs(a.GetNamespace())
existing, err := client.Get(ctx, a.GetName(), metav1.GetOptions{})
Expand Down
19 changes: 0 additions & 19 deletions vendor/k8s.io/client-go/tools/portforward/doc.go

This file was deleted.