You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The current logic attempts to Delete Services from the ProviderResources map when no Routes are found on the cluster, for a given namespace.
// 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.
The text was updated successfully, but these errors were encountered:
Does having a separate cache for these mappings make sense? Something like
type ProviderCache struct {
lock
routeToServicesMappings map[string][]string
serviceToRoutesMappings map[string][]string // *not having this still helps
}
Or we'll probably have to iterate through the ProviderResource cache multiple times
once to find out which services were referred by the deleted route
and second time to find whether the services are referred by other routes currently present.
^ both the steps must be performed for every kind of route in the ProviderResources
This commit fetches the services that were referenced by the route
which has now been deleted, and removes those objects from the
resource map. In order to facilitate this, the commit introduces
a provider cache for kubernetes that stores mappings between
kubernetes objects - for now it stores the map between
[tls/http]route -> backend service references.
So that once the [tls/http]route is deleted we have the services that
it referenced.
Fixes: envoyproxy#536
Signed-off-by: Shubham Chauhan <shubham@tetrate.io>
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.
The text was updated successfully, but these errors were encountered: