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.
Description
The current logic attempts to Delete Services from the ProviderResources map when no Routes are found on the cluster, for a given namespace.
gateway/internal/provider/kubernetes/httproute.go
Line 284 in 81eb817
Snippet
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.