Skip to content

Commit

Permalink
Merge pull request #1390 from kyrtapz/svc_event_panic
Browse files Browse the repository at this point in the history
[release-4.8] OCPBUGS-3554: services: log errors and don't panic if the service doesn't exist
  • Loading branch information
openshift-merge-robot committed Dec 6, 2022
2 parents 43dfd31 + 74eae46 commit 0b69324
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Expand Up @@ -243,8 +243,12 @@ func (c *Controller) syncServices(key string) error {
if err != nil || !util.ServiceTypeHasClusterIP(service) || !util.IsClusterIPSet(service) {
err = deleteVIPsFromAllOVNBalancers(vipsTracked, name, namespace)
if err != nil {
c.eventRecorder.Eventf(service, v1.EventTypeWarning, "FailedToDeleteOVNLoadBalancer",
"Error trying to delete the OVN LoadBalancer for Service %s/%s: %v", name, namespace, err)
// If the service wasn't found, don't panic sending an
// an event after cleaning it up
if service != nil {
c.eventRecorder.Eventf(service, v1.EventTypeWarning, "FailedToDeleteOVNLoadBalancer",
"Error trying to delete the OVN LoadBalancer for Service %s/%s: %v", name, namespace, err)
}
return err
}
// Delete the Service form the Service Tracker
Expand Down
2 changes: 1 addition & 1 deletion go-controller/pkg/ovn/controller/services/utils.go
Expand Up @@ -90,7 +90,7 @@ func deleteVIPsFromNonIdlingOVNBalancers(vips sets.String, name, namespace strin

for proto := range foundProtocols {
if err := loadbalancer.DeleteLoadBalancerVIPs(lbsPerProtocol[proto].List(), vipsPerProtocol[proto].List()); err != nil {
klog.Errorf("Error deleting VIP %v on OVN LoadBalancer %v", vipsPerProtocol[proto].List(), lbsPerProtocol[proto].List())
klog.Errorf("Error deleting VIP %v on OVN LoadBalancer %v: %v", vipsPerProtocol[proto].List(), lbsPerProtocol[proto].List(), err)
return err
}
}
Expand Down

0 comments on commit 0b69324

Please sign in to comment.