func (j *TestJig) CreateOnlyLocalNodePortService(createPod bool) (*v1.Service, error) {
	ginkgo.By("creating a service " + j.Namespace + "/" + j.Name + " with type=NodePort and ExternalTrafficPolicy=Local")
	svc, err := j.CreateTCPService(func(svc *v1.Service) {
		svc.Spec.Type = v1.ServiceTypeNodePort
		svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
		svc.Spec.Ports = []v1.ServicePort{{Protocol: v1.ProtocolTCP, Port: 80}}
	})
	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
		}
	}
	return svc, nil
}
// CreateOnlyLocalNodePortService creates a NodePort service with
// ExternalTrafficPolicy set to Local and sanity checks its nodePort.
// If createPod is true, it also creates an RC with 1 replica of
// the standard netexec container used everywhere in this test.
CreateOnlyLocalNodePortService creates a NodePort service with
ExternalTrafficPolicy set to Local and sanity checks its nodePort.
If createPod is true, it also creates an RC with 1 replica of
the standard netexec container used everywhere in this test.
// CreateOnlyLocalNodePortService creates a NodePort service with // ExternalTrafficPolicy set to Local and sanity checks its nodePort . // 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) CreateOnlyLocalNodePortService(createPod bool) (*v1.Service, error) {
	ginkgo.By("creating a service " + j.Namespace + "/" + j.Name + " with type=NodePort and ExternalTrafficPolicy=Local")
	svc, err := j.CreateTCPService(func(svc *v1.Service) {
		svc.Spec.Type = v1.ServiceTypeNodePort
		svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
		svc.Spec.Ports = []v1.ServicePort{{Protocol: v1.ProtocolTCP, Port: 80}}
	})
	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
		}
	}
	return svc, nil
}
func ( j * TestJig ) CreateOnlyLocalNodePortService ( createPod bool ) ( * v1 . Service , error ) { ginkgo . By ( " " + j . Namespace + " " + j . Name + " " ) svc , err := j . CreateTCPService ( func ( svc * v1 . Service ) { svc . Spec . Type = v1 . ServiceTypeNodePort svc . Spec . ExternalTrafficPolicy = v1 . ServiceExternalTrafficPolicyTypeLocal svc . Spec . Ports = [ ] v1 . ServicePort { { Protocol : v1 . ProtocolTCP , Port : 80 } } } ) if err != nil { return nil , err } if createPod { ginkgo . By ( " " + j . Name ) _ , err = j . Run ( nil ) if err != nil { return nil , err } } return svc , nil }
CreateOnlyLocalNodePortService creates a NodePort service with
ExternalTrafficPolicy set to Local and sanity checks its nodePort.
CreateOnlyLocalNodePortService creates a NodePort service with ExternalTrafficPolicy set to Local and sanity checks its nodePort .