Ideas around reporting Policy configuration in Route Status #1531
sunjayBhatia
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Could this also be extended to HTTPRoute extension refs? As far as I know extension refs can suffer from similar issues to display effective configuration. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
These ideas could be used by the upstream project itself to provide a mechanism for implementers of the Gateway API.
This is mostly an exercise in seeing if it is feasible to do something in this space, and what solutions could look like.
The suggestions here may be combined or used separately where appropriate.
Add the "effective policy configuration" to the
RouteParentStatus
type.This is an effort to signify the applied policies flow down from individual Gateway hierarchies, especially given Routes may be attached to different Gateways.
We could go with an approach that does not include this information under
RouteParentStatus
, but would need to then duplicate some of the fields from this struct, namelycontrollerName
to ensure we know which controller handled the Policy and set the configuration.A possible resulting Status example:
This follows this spike and included example YAML for HTTPRoutes and RateLimitPolicies.
It uses this spike on the Gateway API.
Here we've also added the
sectionName
field which could be used ifPolicyTargetReference
supports it in the future and the value would the name of theHTTPRouteRule
this final Policy applies to.The
policyValue
is just marshalled JSON from the RateLimitPolicy for simplicity in this example.The values here represent the combination of a Policy applied to a Gateway and the Policy applied to the HTTPRoute this Status is set on.
Rather than using a structured type to represent the kind of Policy that is in effect, we could use a type usable as a map key.
This would ensure one effective Policy is set per kind.
See Contour spike and Gateway API changes
Resulting in Status:
Expressing the actual value of the Policy settings in Status is a bit complicated.
One way could be to introduce a
PolicySettings
list, that would allow us to show individual field settings and what Policy resource they came from.We can again use the
field
name as a unique key to use as a map key for some validation.See example Status below.
Here we can see a field has been set by the Policy targeting the Gateway and others set by the Policy targeting the HTTPRoute itself.
This approach as a few upsides, since it offers a lot of visibility into fields, values, and what resources they were configured in.
However, it is a bit complicated and can definitely become unwieldy if a Policy resource grows to contain many fields or any significant nested structure.
See Contour spike and Gateway API spike.
Instead of expressing the values specified by a hierarchy of Policies in Status directly, we could instead have the controller implementing the Route and applying Policies simply add a reference to a new Policy generated with the resulting values.
We would add to the
RouteParentStatus
(or other location):These would be a list of references to Policy objects that were generated to express what Policy values are actually in effect, given the defaults and overrides applied.
There could be some validation that the group/kind/name of these weren't repeated.
Some example status:
One thing to handle here is what the
targetRef
in this generated Policy would be set to, since this shouldn't actually be applied to any resource.Downsides:
The above option becomes a little more attractive, if the upstream APIs supply a
PolicyAttachment
type similar toReferenceGrant
that connects some implementation specific Policy resource and the Gateway API resource (or other) that it targets.The generated Status would not reference a Gateway API PolicyAttachment resource but rather the implementation specific Policy.
An instance of a PolicyAttachment might look like:
This idea has other implications and might be something to explore as it gives some structure to implementers of the API.
Beta Was this translation helpful? Give feedback.
All reactions