Skip to content

Commit

Permalink
Merge pull request #211 from linode/handle-type-change
Browse files Browse the repository at this point in the history
[bugfix] - handle LoadBalancer deletion if service type changes to no longer be a LoadBalancer
  • Loading branch information
AshleyDumaine authored May 21, 2024
2 parents a3d86de + 46c52d8 commit 58731f5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cloud/linode/service_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ func (s *serviceController) Run(stopCh <-chan struct{}) {
klog.Infof("ServiceController will handle service (%s) deletion", getServiceNn(service))
s.queue.Add(service)
},
UpdateFunc: func(oldObj, newObj interface{}) {
newSvc, ok := newObj.(*v1.Service)
if !ok {
return
}
oldSvc, ok := oldObj.(*v1.Service)
if !ok {
return
}

if newSvc.Spec.Type != "LoadBalancer" && oldSvc.Spec.Type == "LoadBalancer" {
klog.Infof("ServiceController will handle service (%s) LoadBalancer deletion", getServiceNn(oldSvc))
s.queue.Add(oldSvc)
}
},
}); err != nil {
klog.Errorf("ServiceController didn't successfully register it's Informer %s", err)
}
Expand Down

0 comments on commit 58731f5

Please sign in to comment.