func NewIstioClient(kubeconfigPath string) (*istioclient.Clientset, error) {
	var err error
	var istioConf *rest.Config
	if kubeconfigPath == "" {
		istioConf, err = rest.InClusterConfig()
		if err != nil {
			return nil, fmt.Errorf("build default in cluster istio config failed: %w", err)
		}
	} else {
		istioConf, err = clientcmd.BuildConfigFromFlags("", kubeconfigPath)
		if err != nil {
			return nil, fmt.Errorf("build istio client config from config file failed: %w", err)
		}
	}
	return istioclient.NewForConfig(istioConf)
}
NewIstioClient creates new istio client which use to handle istio CRD
package utils
import (
	"context"
	"fmt"
	"github.com/aeraki-framework/aeraki/lazyxds/pkg/utils/log"
	istioclient "istio.io/client-go/pkg/clientset/versioned"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
	"time"
)
func NewKubeClient(kubeconfigPath string) (*kubernetes.Clientset, error) {
	var err error
	var kubeConf *rest.Config
	if kubeconfigPath == "" {
		kubeConf, err = rest.InClusterConfig()
		if err != nil {
			return nil, fmt.Errorf("build default in cluster kube config failed: %w", err)
		}
	} else {
		kubeConf, err = clientcmd.BuildConfigFromFlags("", kubeconfigPath)
		if err != nil {
			return nil, fmt.Errorf("build kube client config from config file failed: %w", err)
		}
	}
	return kubernetes.NewForConfig(kubeConf)
}