Description:
Currently, AIGateayRoute will be translated with two static HTTPRouteFilters as you can see here
|
func defaultHTTPRouteFilters(ns string) []*egv1a1.HTTPRouteFilter { |
|
return []*egv1a1.HTTPRouteFilter{ |
|
{ |
|
ObjectMeta: metav1.ObjectMeta{Name: hostRewriteHTTPFilterName, Namespace: ns}, |
|
Spec: egv1a1.HTTPRouteFilterSpec{ |
|
URLRewrite: &egv1a1.HTTPURLRewriteFilter{ |
|
Hostname: &egv1a1.HTTPHostnameModifier{ |
|
Type: egv1a1.BackendHTTPHostnameModifier, |
|
}, |
|
}, |
|
}, |
|
}, |
|
{ |
|
ObjectMeta: metav1.ObjectMeta{Name: routeNotFoundResponseHTTPFilterName, Namespace: ns}, |
|
Spec: egv1a1.HTTPRouteFilterSpec{ |
|
DirectResponse: &egv1a1.HTTPDirectResponseFilter{ |
|
StatusCode: ptr.To(404), |
|
Body: &egv1a1.CustomResponseBody{ |
|
Inline: ptr.To( |
|
// "Likely" since the matching rule can be arbitrary, not necessarily matching on the model name. |
|
`No matching route found. It is likely that the model specified your request is not configured in the Gateway.`, |
|
), |
|
}, |
However, they are statically generated, not per AIGatewayRoute, so there is no garbage collecting mechanism to it. For example, deleting AIGatewayRoute, etc won't clean them up.
We can create these two resources per AIGatewayRoute, and add the ownerreference to them to make sure that these two filter resources will be cleaned up. The required change should look similar to the one you see in the issue description of #872
Description:
Currently, AIGateayRoute will be translated with two static HTTPRouteFilters as you can see here
ai-gateway/internal/controller/ai_gateway_route.go
Lines 98 to 120 in f037bd2
However, they are statically generated, not per AIGatewayRoute, so there is no garbage collecting mechanism to it. For example, deleting AIGatewayRoute, etc won't clean them up.
We can create these two resources per AIGatewayRoute, and add the ownerreference to them to make sure that these two filter resources will be cleaned up. The required change should look similar to the one you see in the issue description of #872