Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced gateway api topology #751

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions controllers/authpolicy_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ func (r *AuthPolicyReconciler) generateTopology(ctx context.Context) (*kuadrantg
})

return kuadrantgatewayapi.NewTopology(
kuadrantgatewayapi.WithAcceptedRoutesLinkedOnly(),
kuadrantgatewayapi.WithProgrammedGatewaysOnly(),
kuadrantgatewayapi.WithGateways(utils.Map(gwList.Items, ptr.To[gatewayapiv1.Gateway])),
kuadrantgatewayapi.WithRoutes(utils.Map(routeList.Items, ptr.To[gatewayapiv1.HTTPRoute])),
kuadrantgatewayapi.WithPolicies(policies),
Expand Down
1 change: 1 addition & 0 deletions controllers/ratelimitpolicy_enforced_status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ func (r *RateLimitPolicyEnforcedStatusReconciler) buildTopology(ctx context.Cont
}

return kuadrantgatewayapi.NewTopology(
kuadrantgatewayapi.WithAcceptedRoutesLinkedOnly(),
kuadrantgatewayapi.WithGateways(utils.Map(gatewayList.Items, ptr.To[gatewayapiv1.Gateway])),
kuadrantgatewayapi.WithRoutes(utils.Map(routeList.Items, ptr.To[gatewayapiv1.HTTPRoute])),
kuadrantgatewayapi.WithPolicies(utils.Map(policyList.Items, func(p kuadrantv1beta2.RateLimitPolicy) kuadrantgatewayapi.Policy { return &p })),
Expand Down
2 changes: 2 additions & 0 deletions controllers/ratelimitpolicy_limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func (r *RateLimitPolicyReconciler) buildTopology(ctx context.Context, policies
}

return kuadrantgatewayapi.NewTopology(
kuadrantgatewayapi.WithAcceptedRoutesLinkedOnly(),
kuadrantgatewayapi.WithProgrammedGatewaysOnly(),
kuadrantgatewayapi.WithGateways(utils.Map(gwList.Items, ptr.To[gatewayapiv1.Gateway])),
kuadrantgatewayapi.WithRoutes(utils.Map(routeList.Items, ptr.To[gatewayapiv1.HTTPRoute])),
kuadrantgatewayapi.WithPolicies(policies),
Expand Down
2 changes: 2 additions & 0 deletions controllers/target_status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ func (r *TargetStatusReconciler) buildTopology(ctx context.Context, gw *gatewaya
}

t, err := kuadrantgatewayapi.NewTopology(
kuadrantgatewayapi.WithAcceptedRoutesLinkedOnly(),
kuadrantgatewayapi.WithProgrammedGatewaysOnly(),
kuadrantgatewayapi.WithGateways([]*gatewayapiv1.Gateway{gw}),
kuadrantgatewayapi.WithRoutes(utils.Map(routeList.Items, ptr.To[gatewayapiv1.HTTPRoute])),
kuadrantgatewayapi.WithPolicies(policies),
Expand Down
19 changes: 19 additions & 0 deletions pkg/library/gatewayapi/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,22 @@ func testBasicRoutePolicy(name, namespace string, route *gatewayapiv1.HTTPRoute)
},
}
}

func testStandalonePolicy(name, namespace string) Policy {
return &TestPolicy{
TypeMeta: metav1.TypeMeta{
APIVersion: "example.com/v1",
Kind: "TestPolicy",
},
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: name,
},
TargetRef: gatewayapiv1alpha2.PolicyTargetReference{
Group: gatewayapiv1.Group(gatewayapiv1.GroupName),
Kind: gatewayapiv1.Kind("Gateway"),
Namespace: ptr.To(gatewayapiv1.Namespace("unknown")),
Name: gatewayapiv1.ObjectName("unknown"),
},
}
}
Loading
Loading