From ab797d1b6590a1921373dd85f040fc01a3221de8 Mon Sep 17 00:00:00 2001 From: Alex Robinson Date: Fri, 26 Feb 2016 19:38:19 +0000 Subject: [PATCH] A load balancer should be updated if a service's UID has changed. The load balancer's name is determined by the service's UID. If the service's UID has changed (presumably due to a delete and recreate), then we need to recreate the load balancer as well to avoid eventually leaking the old one. --- pkg/controller/service/servicecontroller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/controller/service/servicecontroller.go b/pkg/controller/service/servicecontroller.go index dee6f7207a1..508d4d5ca9d 100644 --- a/pkg/controller/service/servicecontroller.go +++ b/pkg/controller/service/servicecontroller.go @@ -498,6 +498,11 @@ func (s *ServiceController) needsUpdate(oldService *api.Service, newService *api if !reflect.DeepEqual(oldService.Annotations, newService.Annotations) { return true } + if oldService.UID != newService.UID { + s.eventRecorder.Eventf(newService, api.EventTypeNormal, "UID", "%v -> %v", + oldService.UID, newService.UID) + return true + } return false }