func (j *TestJig) WaitForEndpointOnNode(nodeName string) error {
	return wait.PollImmediate(framework.Poll, KubeProxyLagTimeout, func() (bool, error) {
		endpoints, err := j.Client.CoreV1().Endpoints(j.Namespace).Get(context.TODO(), j.Name, metav1.GetOptions{})
		if err != nil {
			framework.Logf("Get endpoints for service %s/%s failed (%s)", j.Namespace, j.Name, err)
			return false, nil
		}
		if len(endpoints.Subsets) == 0 {
			framework.Logf("Expect endpoints with subsets, got none.")
			return false, nil
		}
		// TODO: Handle multiple endpoints
		if len(endpoints.Subsets[0].Addresses) == 0 {
			framework.Logf("Expected Ready endpoints - found none")
			return false, nil
		}
		epHostName := *endpoints.Subsets[0].Addresses[0].NodeName
		framework.Logf("Pod for service %s/%s is on node %s", j.Namespace, j.Name, epHostName)
		if epHostName != nodeName {
			framework.Logf("Found endpoint on wrong node, expected %v, got %v", nodeName, epHostName)
			return false, nil
		}
		return true, nil
	})
}
// WaitForEndpointOnNode waits for a service endpoint on the given node.
WaitForEndpointOnNode waits for a service endpoint on the given node.
// WaitForEndpointOnNode waits for a service endpoint on the given node .
func (j *TestJig) WaitForEndpointOnNode(nodeName string) error {
	return wait.PollImmediate(framework.Poll, KubeProxyLagTimeout, func() (bool, error) {
		endpoints, err := j.Client.CoreV1().Endpoints(j.Namespace).Get(context.TODO(), j.Name, metav1.GetOptions{})
		if err != nil {
			framework.Logf("Get endpoints for service %s/%s failed (%s)", j.Namespace, j.Name, err)
			return false, nil
		}
		if len(endpoints.Subsets) == 0 {
			framework.Logf("Expect endpoints with subsets, got none.")
			return false, nil
		}
		if len(endpoints.Subsets[0].Addresses) == 0 {
			framework.Logf("Expected Ready endpoints - found none")
			return false, nil
		}
		epHostName := *endpoints.Subsets[0].Addresses[0].NodeName
		framework.Logf("Pod for service %s/%s is on node %s", j.Namespace, j.Name, epHostName)
		if epHostName != nodeName {
			framework.Logf("Found endpoint on wrong node, expected %v, got %v", nodeName, epHostName)
			return false, nil
		}
		return true, nil
	})
}
func ( j * TestJig ) WaitForEndpointOnNode ( nodeName string ) error { return wait . PollImmediate ( framework . Poll , KubeProxyLagTimeout , func ( ) ( bool , error ) { endpoints , err := j . Client . CoreV1 ( ) . Endpoints ( j . Namespace ) . Get ( context . TODO ( ) , j . Name , metav1 . GetOptions { } ) if err != nil { framework . Logf ( " " , j . Namespace , j . Name , err ) return false , nil } if len ( endpoints . Subsets ) == 0 { framework . Logf ( " " ) return false , nil } if len ( endpoints . Subsets [ 0 ] . Addresses ) == 0 { framework . Logf ( " " ) return false , nil } epHostName := * endpoints . Subsets [ 0 ] . Addresses [ 0 ] . NodeName framework . Logf ( " " , j . Namespace , j . Name , epHostName ) if epHostName != nodeName { framework . Logf ( " " , nodeName , epHostName ) return false , nil } return true , nil } ) }
WaitForEndpointOnNode waits for a service endpoint on the given node.
WaitForEndpointOnNode waits for a service endpoint on the given node .
// TODO: Handle multiple endpoints