~Draft pending https://github.com/istio/istio/pull/59342~
Like https://github.com/agentgateway/agentgateway/pull/1147 but for
policies. Original work in
https://github.com/kgateway-dev/kgateway/pull/13247 but changed a lot
since then.
Lots of changes... to facilitate this.
* merge redundant types: TypedResource, ParentKey,
utils.typednamespacename since we need to use them as a consistent thing
(https://github.com/agentgateway/agentgateway/issues/1161)
* Instead of just 'ancestors', which is a Backend --> Gateway index,
build a new "References" index that can take any type (gateway,
listenerset, route, backend) and reverse it to the Gateway(s) its a part
of.
* Add a test for ancestors to make sure all combinations of
{ListenerSet,RouteTYpe,BackendType} works. I didn't think ListenerSet
would pass but it did which is great, so no change needed there.
* Extend the 'route attachment' object to include the Gateway. Before,
we have Route --> Gateway OR ListenerSet. Its trivial to add a new
Gateway field that always has the Gateway in the case of a ListenerSet,
which gives us our Route --> ListenerSet mapping.
* We do NOT have a ListenerSet --> Gateway mapping. its trivial to add,
but not needed until we actually support ListenerSet in AGWPolicy.
* Change all the golden tests to consistently use the full TestSyncer
flow, which allows them to get ReferenceIndex.
* As a side effect, the YAML changes a bit. I ran each one through Codex
and it found many real issues which I have no fixed and it gives a clean
bill of 'these changes are formatting only'.
* Real bug found unrelated to this change: response and request header
modifiers used the same key, so you could only set one and the other was
dropped.
- updates kgateway-system -> agentgateway-system in dev docs and unit
tests
- adds unit tests for backend AgentgatewayPolicy with multiple
targetRefs
Signed-off-by: npolshakova <nina.polshakova@solo.io>
This lets you write policies on the LLM request directly. For example:
```yaml
transformation:
max_tokens: min(llmRequest.max_tokens, 1024) # I am cheap, don't let my users burn tokens
```
The release workflow now publishes the controller package too. Tested it
on my fork: https://github.com/npolshakova/agentgateway/packages
Currently tested:
- [x] make generate-all
- [x] make analyze
- [x] make fmt
- [x] make unit - passing
- [x] make run
- [x] make package-agentgateway-charts
- [x] make kind-build-and-load
- [x] make kind-load-agentgateway
---------
Signed-off-by: npolshakova <nina.polshakova@solo.io>