Fix retry logic in service controller

This commit is contained in:
Zihong Zheng 2017-10-18 16:58:19 -07:00
parent ea07264251
commit 72542f5b82

View File

@ -244,15 +244,17 @@ func (s *ServiceController) processServiceUpdate(cachedService *cachedService, s
err, retry := s.createLoadBalancerIfNeeded(key, service) err, retry := s.createLoadBalancerIfNeeded(key, service)
if err != nil { if err != nil {
message := "Error creating load balancer" message := "Error creating load balancer"
var retryToReturn time.Duration
if retry { if retry {
message += " (will retry): " message += " (will retry): "
retryToReturn = cachedService.nextRetryDelay()
} else { } else {
message += " (will not retry): " message += " (will not retry): "
retryToReturn = doNotRetry
} }
message += err.Error() message += err.Error()
s.eventRecorder.Event(service, v1.EventTypeWarning, "CreatingLoadBalancerFailed", message) s.eventRecorder.Event(service, v1.EventTypeWarning, "CreatingLoadBalancerFailed", message)
return err, retryToReturn
return err, cachedService.nextRetryDelay()
} }
// Always update the cache upon success. // Always update the cache upon success.
// NOTE: Since we update the cached service if and only if we successfully // NOTE: Since we update the cached service if and only if we successfully