From 192942420c9085f5a8bdc2c71e4f4cc9bbff42ff Mon Sep 17 00:00:00 2001 From: dprotaso Date: Wed, 9 Jun 2021 15:08:19 -0400 Subject: [PATCH] drop kubeclient struct --- test/clients.go | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/test/clients.go b/test/clients.go index 37301ae4c7..fa737b603c 100644 --- a/test/clients.go +++ b/test/clients.go @@ -26,19 +26,12 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" - k8styped "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "knative.dev/pkg/test/logging" "knative.dev/pkg/test/spoof" ) -// KubeClient holds instances of interfaces for making requests to kubernetes client. -// Deprecated: use a kubeclient and the helper methods in test. -type KubeClient struct { - kubernetes.Interface -} - // NewSpoofingClient returns a spoofing client to make requests func NewSpoofingClient(ctx context.Context, client kubernetes.Interface, logf logging.FormatLogger, domain string, resolvable bool, opts ...spoof.TransportOption) (*spoof.SpoofingClient, error) { @@ -46,22 +39,6 @@ func NewSpoofingClient(ctx context.Context, client kubernetes.Interface, logf lo Flags.SpoofRequestInterval, Flags.SpoofRequestTimeout, opts...) } -// NewKubeClient instantiates and returns several clientsets required for making request to the -// kube client specified by the combination of clusterName and configPath. Clients can make requests within namespace. -// Deprecated: use a kubeclient and the helper methods in test. -func NewKubeClient(configPath string, clusterName string) (*KubeClient, error) { - cfg, err := BuildClientConfig(configPath, clusterName) - if err != nil { - return nil, err - } - - k, err := kubernetes.NewForConfig(cfg) - if err != nil { - return nil, err - } - return &KubeClient{Interface: k}, nil -} - // BuildClientConfig builds the client config specified by the config path and the cluster name func BuildClientConfig(kubeConfigPath string, clusterName string) (*rest.Config, error) { overrides := clientcmd.ConfigOverrides{} @@ -74,12 +51,6 @@ func BuildClientConfig(kubeConfigPath string, clusterName string) (*rest.Config, &overrides).ClientConfig() } -// UpdateConfigMap updates the config map for specified @name with values -// Deprecated: use UpdateConfigMap -func (client *KubeClient) UpdateConfigMap(ctx context.Context, name string, configName string, values map[string]string) error { - return UpdateConfigMap(ctx, client, name, configName, values) -} - // UpdateConfigMap updates the config map for specified @name with values func UpdateConfigMap(ctx context.Context, client kubernetes.Interface, name string, configName string, values map[string]string) error { configMap, err := client.CoreV1().ConfigMaps(name).Get(ctx, configName, metav1.GetOptions{}) @@ -95,30 +66,12 @@ func UpdateConfigMap(ctx context.Context, client kubernetes.Interface, name stri return err } -// GetConfigMap gets the knative serving config map. -// Deprecated: use kubeclient.CoreV1().ConfigMaps(name) -func (client *KubeClient) GetConfigMap(name string) k8styped.ConfigMapInterface { - return client.CoreV1().ConfigMaps(name) -} - -// CreatePod will create a Pod -// Deprecated: use CreatePod -func (client *KubeClient) CreatePod(ctx context.Context, pod *corev1.Pod) (*corev1.Pod, error) { - return CreatePod(ctx, client, pod) -} - // CreatePod will create a Pod func CreatePod(ctx context.Context, client kubernetes.Interface, pod *corev1.Pod) (*corev1.Pod, error) { pods := client.CoreV1().Pods(pod.GetNamespace()) return pods.Create(ctx, pod, metav1.CreateOptions{}) } -// PodLogs returns Pod logs for given Pod and Container in the namespace -// Deprecated: use PodLogs -func (client *KubeClient) PodLogs(ctx context.Context, podName, containerName, namespace string) ([]byte, error) { - return PodLogs(ctx, client, podName, containerName, namespace) -} - // PodLogs returns Pod logs for given Pod and Container in the namespace func PodLogs(ctx context.Context, client kubernetes.Interface, podName, containerName, namespace string) ([]byte, error) { pods := client.CoreV1().Pods(namespace)