-
Notifications
You must be signed in to change notification settings - Fork 714
Fix logic for deleting Services from ProviderResources #536
Copy link
Copy link
Closed
Description
Description
The current logic attempts to Delete Services from the ProviderResources map when no Routes are found on the cluster, for a given namespace.
| r.resources.Services.Delete(request.NamespacedName) |
Snippet
// Delete the Namespace and Service from the resource maps if no other
// routes exist in the namespace.
routeList = &gwapiv1b1.HTTPRouteList{}
if err := r.client.List(ctx, routeList, &client.ListOptions{Namespace: request.Namespace}); err != nil {
return reconcile.Result{}, fmt.Errorf("error listing httproutes")
}
if len(routeList.Items) == 0 {
r.resources.Namespaces.Delete(request.Namespace)
log.Info("deleted namespace from resource map")
r.resources.Services.Delete(request.NamespacedName)
log.Info("deleted service from resource map")
}
This tries deleting a Service with namespace/name that matches the HTTPRoute which came in to be Reconciled. This will not be the case most of the times.
We must delete the Services which were referred to by the HTTPRoute that has been now deleted.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working