Commit 5a76d7ab authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #50539 from brendandburns/svc

Automatic merge from submit-queue (batch tested with PRs 51108, 51035, 50539, 51160, 50947) Delete load balancers if the UIDs for services don't match. An attempt to fix https://github.com/kubernetes/kubernetes/issues/43730 @thockin @djsly
parents 737ded5a 813d264c
...@@ -223,7 +223,14 @@ func (s *ServiceController) init() error { ...@@ -223,7 +223,14 @@ func (s *ServiceController) init() error {
// indicating whether processing should be retried; zero means no-retry; otherwise // indicating whether processing should be retried; zero means no-retry; otherwise
// we should retry in that Duration. // we should retry in that Duration.
func (s *ServiceController) processServiceUpdate(cachedService *cachedService, service *v1.Service, key string) (error, time.Duration) { func (s *ServiceController) processServiceUpdate(cachedService *cachedService, service *v1.Service, key string) (error, time.Duration) {
if cachedService.state != nil {
if cachedService.state.UID != service.UID {
err, retry := s.processLoadBalancerDelete(cachedService, key)
if err != nil {
return err, retry
}
}
}
// cache the service, we need the info for service deletion // cache the service, we need the info for service deletion
cachedService.state = service cachedService.state = service
err, retry := s.createLoadBalancerIfNeeded(key, service) err, retry := s.createLoadBalancerIfNeeded(key, service)
...@@ -764,6 +771,10 @@ func (s *ServiceController) processServiceDeletion(key string) (error, time.Dura ...@@ -764,6 +771,10 @@ func (s *ServiceController) processServiceDeletion(key string) (error, time.Dura
if !ok { if !ok {
return fmt.Errorf("Service %s not in cache even though the watcher thought it was. Ignoring the deletion.", key), doNotRetry return fmt.Errorf("Service %s not in cache even though the watcher thought it was. Ignoring the deletion.", key), doNotRetry
} }
return s.processLoadBalancerDelete(cachedService, key)
}
func (s *ServiceController) processLoadBalancerDelete(cachedService *cachedService, key string) (error, time.Duration) {
service := cachedService.state service := cachedService.state
// delete load balancer info only if the service type is LoadBalancer // delete load balancer info only if the service type is LoadBalancer
if !wantsLoadBalancer(service) { if !wantsLoadBalancer(service) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment