func (j *TestJig) CreateOnlyLocalLoadBalancerService(timeout time.Duration, createPod bool,
	tweak func(svc *v1.Service)) (*v1.Service, error) {
	_, err := j.CreateLoadBalancerService(timeout, func(svc *v1.Service) {
		ginkgo.By("setting ExternalTrafficPolicy=Local")
		svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
		if tweak != nil {
			tweak(svc)
		}
	})
	if err != nil {
		return nil, err
	}

	if createPod {
		ginkgo.By("creating a pod to be part of the service " + j.Name)
		_, err = j.Run(nil)
		if err != nil {
			return nil, err
		}
	}
	ginkgo.By("waiting for loadbalancer for service " + j.Namespace + "/" + j.Name)
	return j.WaitForLoadBalancer(timeout)
}
// CreateOnlyLocalLoadBalancerService creates a loadbalancer service with
// ExternalTrafficPolicy set to Local and waits for it to acquire an ingress IP.
// If createPod is true, it also creates an RC with 1 replica of
// the standard netexec container used everywhere in this test.
CreateOnlyLocalLoadBalancerService creates a loadbalancer service with
ExternalTrafficPolicy set to Local and waits for it to acquire an ingress IP.
If createPod is true, it also creates an RC with 1 replica of
the standard netexec container used everywhere in this test.
// CreateOnlyLocalLoadBalancerService creates a loadbalancer service with // ExternalTrafficPolicy set to Local and waits for it to acquire an ingress IP . // If createPod is true it also creates an RC with 1 replica of // the standard netexec container used everywhere in this test .
func (j *TestJig) CreateOnlyLocalLoadBalancerService(timeout time.Duration, createPod bool,
	tweak func(svc *v1.Service)) (*v1.Service, error) {
	_, err := j.CreateLoadBalancerService(timeout, func(svc *v1.Service) {
		ginkgo.By("setting ExternalTrafficPolicy=Local")
		svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
		if tweak != nil {
			tweak(svc)
		}
	})
	if err != nil {
		return nil, err
	}
	if createPod {
		ginkgo.By("creating a pod to be part of the service " + j.Name)
		_, err = j.Run(nil)
		if err != nil {
			return nil, err
		}
	}
	ginkgo.By("waiting for loadbalancer for service " + j.Namespace + "/" + j.Name)
	return j.WaitForLoadBalancer(timeout)
}
func ( j * TestJig ) CreateOnlyLocalLoadBalancerService ( timeout time . Duration , createPod bool , tweak func ( svc * v1 . Service ) ) ( * v1 . Service , error ) { _ , err := j . CreateLoadBalancerService ( timeout , func ( svc * v1 . Service ) { ginkgo . By ( " " ) svc . Spec . ExternalTrafficPolicy = v1 . ServiceExternalTrafficPolicyTypeLocal if tweak != nil { tweak ( svc ) } } ) if err != nil { return nil , err } if createPod { ginkgo . By ( " " + j . Name ) _ , err = j . Run ( nil ) if err != nil { return nil , err } } ginkgo . By ( " " + j . Namespace + " " + j . Name ) return j . WaitForLoadBalancer ( timeout ) }
CreateOnlyLocalLoadBalancerService creates a loadbalancer service with
ExternalTrafficPolicy set to Local and waits for it to acquire an ingress IP.
CreateOnlyLocalLoadBalancerService creates a loadbalancer service with ExternalTrafficPolicy set to Local and waits for it to acquire an ingress IP .