feat(inference): support ListenerSet ParentRefs for inference dependency resolution #13377
This doesn't need the full set of commmonCols
Please remove AI generated comments.
Please add a test for the case where the listener set is used
This PR needs to update the description to match the template
Hi @npolshakova, thanks for the review and guidance.
Here’s a concise summary of the approach I took to address the ListenerSet case.
Approach
resolveListenerSetGateways to prevent panics when commonCol or the client is nil. This keeps the behavior defensive and aligned with existing patterns.
TestReferencedGateways_ListenerSet to cover the case where:
- an HTTPRoute references a ListenerSet, and
- the ListenerSet in turn references a Gateway.
Verification
The test was run locally using:
go clean -testcache
go test -v ./pkg/kgateway/agentgatewaysyncer/backend/inferencepool/ -run TestReferencedGateways_ListenerSet
Attaching a screenshot of the local test run showing the test passing.
<img width="1917" height="525" alt="Screenshot 2026-02-07 005723" src="https://github.com/user-attachments/assets/da1ef35b-0ded-4b63-9d16-dfcbc06d9163" />
You latest change removed all comments in the file, including existing comments we want to keep. Please be more mindful when using AI and review changes in the diff or we will close these prs out without review for violating the AI policy.
Hi @npolshakova mam — sorry about that, and thanks for calling it out.
You’re right: the previous change unintentionally removed existing comments along with the AI-generated ones. I’ve now reverted that and restored all original comments, keeping only the intended code changes.
I’ve double-checked the diff to make sure no existing comments were altered or removed this time.
Thanks for the patience and the guidance — appreciate the review.
Hi @npolshakova mam ,
While attempting to rebase and resolve conflicts for this PR, I investigated why the changes could not be applied on the current main.
It turns out that the entire agentgateway control plane (including pkg/kgateway/agentgatewaysyncer/) was removed from the kgateway repository in commit 30cc52c45 as part of the v2.3.0-beta.2 changes. Approximately ~74k lines of code were removed when the control plane was migrated to the separate agentgateway repository.
Because of this change:
The files modified by this PR (pkg/kgateway/agentgatewaysyncer/backend/inferencepool/...) no longer exist in the kgateway codebase.
The related types and infrastructure required by the inference pool logic have also been removed.
From the current repository documentation:
Starting with version 2.3.0, the control plane for agentgateway has been migrated to the agentgateway repository.
Given this, it seems that this feature should likely be implemented in the agentgateway repository instead:
https://github.com/agentgateway/agentgateway
If that direction makes sense, I can close this PR and port the ListenerSet ParentRef support logic to the agentgateway repository? or what I can do
npolshakova
Aaravanand00
Description
Motivation
The inference plugin currently resolves dependencies only when an HTTPRoute references a Gateway directly. When a route references a ListenerSet as a ParentRef, the inference dependency resolution does not correctly resolve the underlying Gateway resources.
This PR adds support for resolving ListenerSet ParentRefs so that inference dependency resolution works correctly for configurations that reference ListenerSets.
What changed
Added logic to resolve ListenerSet ParentRefs referenced by HTTPRoute.
Extracted parent Gateways from the resolved ListenerSet and reused the existing inference resolution logic.
Added nil-safety guards in the ListenerSet resolution path to prevent potential panics.
Added a focused unit test (TestReferencedGateways_ListenerSet) to validate ListenerSet → Gateway resolution.
Preserved existing comments and maintained backward compatibility with Gateway-only ParentRefs.
Related issues
Fixes #11719
Change Type
/kind feature
Changelog
``
release-note
``NONE