// Updates the external load balancer of a service, assuming we hold the mutex // associated with the service. func (s *ServiceController) lockedUpdateLoadBalancerHosts(service *api.Service, hosts []string) error { if !wantsExternalLoadBalancer(service) { return nil } name := cloudprovider.GetLoadBalancerName(service) err := s.balancer.UpdateTCPLoadBalancer(name, s.zone.Region, hosts) if err == nil { return nil } // It's only an actual error if the load balancer still exists. if _, exists, err := s.balancer.GetTCPLoadBalancer(name, s.zone.Region); err != nil { glog.Errorf("External error while checking if TCP load balancer %q exists: name, %v") } else if !exists { return nil } return err }
func (s *ServiceController) loadBalancerName(service *api.Service) string { return cloudprovider.GetLoadBalancerName(service) }