Skip to content

Commit 58731f5

Browse files
Merge pull request #211 from linode/handle-type-change
[bugfix] - handle LoadBalancer deletion if service type changes to no longer be a LoadBalancer
2 parents a3d86de + 46c52d8 commit 58731f5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cloud/linode/service_controller.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ func (s *serviceController) Run(stopCh <-chan struct{}) {
4747
klog.Infof("ServiceController will handle service (%s) deletion", getServiceNn(service))
4848
s.queue.Add(service)
4949
},
50+
UpdateFunc: func(oldObj, newObj interface{}) {
51+
newSvc, ok := newObj.(*v1.Service)
52+
if !ok {
53+
return
54+
}
55+
oldSvc, ok := oldObj.(*v1.Service)
56+
if !ok {
57+
return
58+
}
59+
60+
if newSvc.Spec.Type != "LoadBalancer" && oldSvc.Spec.Type == "LoadBalancer" {
61+
klog.Infof("ServiceController will handle service (%s) LoadBalancer deletion", getServiceNn(oldSvc))
62+
s.queue.Add(oldSvc)
63+
}
64+
},
5065
}); err != nil {
5166
klog.Errorf("ServiceController didn't successfully register it's Informer %s", err)
5267
}

0 commit comments

Comments
 (0)