code: func (s *ServiceController) processServiceUpdate(cachedService *cachedService, service *v1.Service, key string) error {
  	if cachedService.state != nil {
  		if cachedService.state.UID != service.UID {
  			err := s.processLoadBalancerDelete(cachedService, key)
  			if err != nil {
  				return err
  			}
  		}
  	}
  	// cache the service, we need the info for service deletion
  	cachedService.state = service
  	err := s.syncLoadBalancerIfNeeded(key, service)
  	if err != nil {
  		eventType := "CreatingLoadBalancerFailed"
  		message := "Error creating load balancer (will retry): "
  		if !wantsLoadBalancer(service) {
  			eventType = "CleanupLoadBalancerFailed"
  			message = "Error cleaning up load balancer (will retry): "
  		}
  		message += err.Error()
  		s.eventRecorder.Event(service, v1.EventTypeWarning, eventType, message)
  		return err
  	}
  	// Always update the cache upon success.
  	// NOTE: Since we update the cached service if and only if we successfully
  	// processed it, a cached service being nil implies that it hasn't yet
  	// been successfully processed.
  	s.cache.set(key, cachedService)
  
  	return nil
  }
docs: // processServiceUpdate operates loadbalancers for the incoming service accordingly.
  // Returns an error if processing the service update failed.