Skip to content

Conversation

@wengyao04
Copy link
Contributor

Commit Message

In this PR, I create HTTPRoute for each backend in the AIServiceBackend rules. When AIGatewayRouteController reconciles a AIGatewayRoute, it lists all the HTTPRoutes belongs to that AIGatewayRoute. It also constructs a de-duplicated backends from the rules of that AIGatewayRoute.
The controller creates new HTTRoutes for each backend if they do not exist before, and updates the HTTRoutes if they are already existed. We delete HTTPRoutes if they are not in the backends and only belong to that AIGatewayRoute.
The HTTRoute is created per backend and per AIGatewayRoute, naming convention is <backendName>-<aiGatewayRouteName>, it makes the logic of HTTRoute lifecycle much clearer. Otherwise, I need merge owner references during update.

Related Issues/PRs (if applicable)
Fix issue #509

Special notes for reviewers (if applicable)
N.A.

Signed-off-by: yweng14 <yweng14@bloomberg.net>
@wengyao04 wengyao04 requested a review from a team as a code owner March 30, 2025 23:20
Signed-off-by: yweng14 <yweng14@bloomberg.net>
Signed-off-by: yweng14 <yweng14@bloomberg.net>
Namespace: aiGatewayRoute.Namespace,
},
Spec: gwapiv1.HTTPRouteSpec{},
// List all HTTPRoutes in the same namespace as this aiGatewayRoute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move to a separate function reconcileHTTPRoute as it is getting bigger

if err = c.newHTTPRoute(ctx, &httpRoute, aiGatewayRoute); err != nil {
return fmt.Errorf("failed to construct a new HTTPRoute: %w", err)
// The naming convention of HTTRoute is <backendName>-<aiGatewayRouteName>,
// It is impossible that a HTTRRoute belongs to two AIGatewayRoute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you have two AIGatewayRoute in the same namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is possible that there are two AIGatewayRoute in the same namespace, and they have some same backends. In this implementation we create HTTPRoute per backend for each AIGatewayRoute.

Comment on lines +246 to +248
// Choose default backend whose name is alphabetically smallest.
if defaultBackend == nil || defaultBackend.Name > backend.Name {
defaultBackend = backend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the defaultBackend for?

},
Spec: gwapiv1.HTTPRouteSpec{},
// List all HTTPRoutes in the same namespace as this aiGatewayRoute.
var existingHTTPRoutList gwapiv1.HTTPRouteList
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existingHTTPRouteList

@mathetake
Copy link
Member

i believe we agreed that instead of making HTTPRoute for each Backend, we should support multiple AIGWR attached to one GW that will solve the limitation that this was initially trying to solve

@mathetake mathetake closed this May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants