func (r *ServiceDiscovery) FindMicroServiceInstances(consumerID, microServiceName string, tags utiltags.Tags) ([]*registry.MicroServiceInstance, error) {
	return r.Controller.FindEndpoints(microServiceName, tags)
}
FindMicroServiceInstances find micro-service instances
package kuberegistry
import (
	"math/rand"
	"time"
	"github.com/go-chassis/go-chassis/v2/core/registry"
	utiltags "github.com/go-chassis/go-chassis/v2/pkg/util/tags"
	"k8s.io/client-go/informers"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/tools/clientcmd"
)
const (
	KubeRegistry = "kube"
	DefaultMinResyncPeriod = 1 * time.Second
)
func init() { registry.InstallServiceDiscovery(KubeRegistry, newServiceDiscovery) }
type ServiceDiscovery struct {
	Controller *DiscoveryController
	Name string
}
func ResyncPeriod(options registry.Options) func() time.Duration {
	return func() time.Duration {
		factor := rand.Float64() + 1
		return time.Duration(float64(DefaultMinResyncPeriod.Nanoseconds()) * factor)
	}
}
func createClientOrDie(kubeconfig string) kubernetes.Interface {
	restConfig, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
	if err != nil {
		panic("build config from flags failed" + err.Error())
	}
	client, err := kubernetes.NewForConfig(restConfig)
	if err != nil {
		panic("new client from config failed" + err.Error())
	}
	return client
}
func newServiceDiscovery(options registry.Options) registry.ServiceDiscovery {
	client := createClientOrDie(options.ConfigPath)
	sharedInformers := informers.NewSharedInformerFactory(client, ResyncPeriod(options)())
	controller := NewDiscoveryController(
		sharedInformers.Core().V1().Services(),
		sharedInformers.Core().V1().Endpoints(),
		sharedInformers.Core().V1().Pods(),
		client,
	)
	stop := make(chan struct{})
	sharedInformers.Start(stop)
	controller.Run(stop)
	return &ServiceDiscovery{
		Name:       KubeRegistry,
		Controller: controller,
	}
}
func (r *ServiceDiscovery) GetAllMicroServices() ([]*registry.MicroService, error) {
	return r.Controller.GetAllServices()
}