func (f *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) {
	f.addCall("create")
	if f.Balancers == nil {
		f.Balancers = make(map[string]Balancer)
	}

	name := f.GetLoadBalancerName(ctx, clusterName, service)
	spec := service.Spec

	zone, err := f.GetZone(context.TODO())
	if err != nil {
		return nil, err
	}
	region := zone.Region

	f.Balancers[name] = Balancer{name, region, spec.LoadBalancerIP, spec.Ports, nodes}

	status := &v1.LoadBalancerStatus{}
	status.Ingress = []v1.LoadBalancerIngress{{IP: f.ExternalIP.String()}}

	return status, f.Err
}
// EnsureLoadBalancer is a test-spy implementation of LoadBalancer.EnsureLoadBalancer.
// It adds an entry "create" into the internal method call record.
EnsureLoadBalancer is a test-spy implementation of LoadBalancer.EnsureLoadBalancer.
It adds an entry "create" into the internal method call record.
// EnsureLoadBalancer is a test - spy implementation of LoadBalancer . EnsureLoadBalancer . // It adds an entry " create " into the internal method call record .
func (f *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) {
	f.addCall("create")
	if f.Balancers == nil {
		f.Balancers = make(map[string]Balancer)
	}
	name := f.GetLoadBalancerName(ctx, clusterName, service)
	spec := service.Spec
	zone, err := f.GetZone(context.TODO())
	if err != nil {
		return nil, err
	}
	region := zone.Region
	f.Balancers[name] = Balancer{name, region, spec.LoadBalancerIP, spec.Ports, nodes}
	status := &v1.LoadBalancerStatus{}
	status.Ingress = []v1.LoadBalancerIngress{{IP: f.ExternalIP.String()}}
	return status, f.Err
}
func ( f * Cloud ) EnsureLoadBalancer ( ctx context . Context , clusterName string , service * v1 . Service , nodes [ ] * v1 . Node ) ( * v1 . LoadBalancerStatus , error ) { f . addCall ( " " ) if f . Balancers == nil { f . Balancers = make ( map [ string ] Balancer ) } name := f . GetLoadBalancerName ( ctx , clusterName , service ) spec := service . Spec zone , err := f . GetZone ( context . TODO ( ) ) if err != nil { return nil , err } region := zone . Region f . Balancers [ name ] = Balancer { name , region , spec . LoadBalancerIP , spec . Ports , nodes } status := & v1 . LoadBalancerStatus { } status . Ingress = [ ] v1 . LoadBalancerIngress { { IP : f . ExternalIP . String ( ) } } return status , f . Err }
EnsureLoadBalancer is a test-spy implementation of LoadBalancer.EnsureLoadBalancer.
EnsureLoadBalancer is a test - spy implementation of LoadBalancer . EnsureLoadBalancer .