func newClusterClients(cfg *testConfig) (*TestClusterClients, error) {
	var clusterCfg *rest.Config
	if cfg.KubeconfigUseLocal {
		p := filepath.Join(homedir.HomeDir(), ".kube", "config")
		cfg, err := clientcmd.BuildConfigFromFlags("", p)
		if err != nil {
			return nil, errors.Wrap(err, "unable to initialize Kube config from: "+p)
		}
		clusterCfg = cfg
	} else {
		vaultConfig := &vault.Config{
			Address: cfg.VaultAddress,
			Token:   cfg.VaultToken,
		}
		vaultClient, err := vault.NewVaultClient(vaultConfig)
		if err != nil {
			return nil, errors.Wrap(err, "unable to initialize vault")
		}
		clusterSecret, err := vaultClient.GetClusterSecret(cfg.ClusterName)
		if err != nil {
			return nil, errors.Wrapf(err,
				"unable to get cluster secret for cluster: %s", cfg.ClusterName)
		}
		clusterCfg = &rest.Config{
			Host: clusterSecret.Endpoint,
			TLSClientConfig: rest.TLSClientConfig{
				Insecure: false,
				CAData:   []byte(clusterSecret.CaCert),
				CertData: []byte(clusterSecret.ClientCert),
				KeyData:  []byte(clusterSecret.ClientKey),
			},
		}
	}
	knsClientSet, err := knservingclientset.NewForConfig(clusterCfg)
	if err != nil {
		return nil, err
	}
	k8sClientset, err := kubernetes.NewForConfig(clusterCfg)
	if err != nil {
		return nil, err
	}
	istioClientset, err := networkingv1alpha3.NewForConfig(clusterCfg)
	if err != nil {
		return nil, err
	}
	return &TestClusterClients{
		KnServingClient:       knsClientSet.ServingV1(),
		K8sCoreClient:         k8sClientset.CoreV1(),
		K8sAppsClient:         k8sClientset.AppsV1(),
		IstioNetworkingClient: istioClientset,
	}, nil
}
newClusterClients is a creator for the TestClusterClients
package e2e
import (
	"fmt"
	"path/filepath"
	"k8s.io/client-go/tools/clientcmd"
	"k8s.io/client-go/util/homedir"
	"github.com/gojek/mlp/api/pkg/vault"
	"github.com/pkg/errors"
	networkingv1alpha3 "istio.io/client-go/pkg/clientset/versioned/typed/networking/v1alpha3"
	k8serrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
	corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/rest"
	knservingclientset "knative.dev/serving/pkg/client/clientset/versioned"
	knservingclient "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1"
)
type TestClusterClients struct {
	KnServingClient       knservingclient.ServingV1Interface
	K8sCoreClient         corev1.CoreV1Interface
	K8sAppsClient         appsv1.AppsV1Interface
	IstioNetworkingClient networkingv1alpha3.NetworkingV1alpha3Interface
}