src/server/pkg/pool/pool.go
func NewPool(kubeClient *kube.Clientset, namespace string, serviceName string, port int, queueSize int64, opts ...grpc.DialOption) (*Pool, error) {
	endpointsInterface := kubeClient.CoreV1().Endpoints(namespace)

	watch, err := endpointsInterface.Watch(metav1.ListOptions{
		LabelSelector: metav1.FormatLabelSelector(metav1.SetAsLabelSelector(
			map[string]string{"app": serviceName},
		)),
		Watch: true,
	})
	if err != nil {
		return nil, err
	}

	pool := &Pool{
		port:           port,
		endpointsWatch: watch,
		opts:           opts,
		done:           make(chan struct{}),
		queueSize:      queueSize,
	}
	pool.connsCond = sync.NewCond(&pool.connsLock)
	go pool.watchEndpoints()
	return pool, nil
}
func NewPool(kubeClient *kube.Clientset, namespace string, serviceName string, port int, queueSize int64, opts ...grpc.DialOption) (*Pool, error) {
	endpointsInterface := kubeClient.CoreV1().Endpoints(namespace)

	watch, err := endpointsInterface.Watch(metav1.ListOptions{
		LabelSelector: metav1.FormatLabelSelector(metav1.SetAsLabelSelector(
			map[string]string{"app": serviceName},
		)),
		Watch: true,
	})
	if err != nil {
		return nil, err
	}

	pool := &Pool{
		port:           port,
		endpointsWatch: watch,
		opts:           opts,
		done:           make(chan struct{}),
		queueSize:      queueSize,
	}
	pool.connsCond = sync.NewCond(&pool.connsLock)
	go pool.watchEndpoints()
	return pool, nil
}
// NewPool creates a new connection pool with connections to pods in the
// given service.