Skip to content

feat(gateway): add spec.a2a with Agent CR discovery - #269

Merged
edenreich merged 1 commit into
mainfrom
feat/issue-268-20261003-2027
Oct 3, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/issue-268-20261003-2027

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Summary

Adds Gateway.spec.a2a so the operator can render the gateway's A2A server configuration, including label-selector discovery of Agent CRs. The gateway never talks to the Kubernetes API, so turning Agent CRs into A2A_AGENTS is the operator's job.

API (api/v1alpha1/gateway_types.go)

  • spec.a2a.enabled -> A2A_ENABLED.
  • spec.a2a.agents[] ({name, url}) -> static entries in A2A_AGENTS as <name>=<url>.
  • spec.a2a.serviceDiscovery (enabled, namespace, selector) -> lists Agent CRs matching the selector and appends <metadata.name>=<status.card.url>, falling back to the in-cluster Service URL when the card URL is not reported yet.
  • spec.a2a.resourceUrl -> A2A_RESOURCE_URL, defaulting to <scheme>://<first HTTPRoute hostname>/a2a the same way the MCP resource URL does.
  • spec.a2a.timeouts.client / spec.a2a.timeouts.streamIdle / spec.a2a.cardRefreshInterval -> A2A_CLIENT_TIMEOUT, A2A_STREAM_IDLE_TIMEOUT, A2A_CARD_REFRESH_INTERVAL, emitted only when set so the gateway's own defaults apply otherwise.
  • status.a2aAgents + status.a2aAgentCount, with an A2A print column.

Controller (internal/controller/gateway_controller.go)

  • The Gateway reconciler now watches Agent CRs and re-renders the Deployment when a matching Agent is created, updated or deleted, so the A2A_AGENTS env var changes trigger a rollout.
  • Aliases follow the ^[a-z0-9_-]+$ grammar the gateway shares between MCP_SERVERS and A2A_AGENTS; an invalid or duplicate alias degrades to a bare URL rather than dropping the agent. tools is reserved for MCP only, so it stays a valid A2A alias.
  • Entries are deduped on URL and sorted for determinism; discovery errors are logged and ignored so a transient API failure does not blank out the static list.

Refactors pulled out of the duplication

  • aliasedEndpoints now carries the shared alias/dedup/sort logic for both MCP_SERVERS and A2A_AGENTS.
  • routedResourceURL(gateway, path) backs both mcpResourceURL and a2aResourceURL.
  • gatewaysSelecting(ctx, obj, discovery) backs both the MCP and Agent watch mappers.

Behaviour of the existing MCP path is unchanged; the existing MCP tests cover the refactor.

Testing

task test (169 specs, all green), task lint (0 issues), task generate, task manifests.

Downstream impact

The Gateway CRD grows a new optional block, so the Helm chart values and the docs pages for the Gateway CRD will need the spec.a2a reference once this lands. Gateway-side support is inference-gateway/inference-gateway#756, which is still open - spec.a2a renders env vars that only take effect on a gateway image carrying that PR.

Closes #268

@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner October 3, 2026 20:36
@edenreich
edenreich merged commit e707643 into main Oct 3, 2026
1 check passed
@edenreich
edenreich deleted the feat/issue-268-20261003-2027 branch October 3, 2026 20:47
inference-gateway-releaser Bot added a commit that referenced this pull request Oct 3, 2026
## [0.27.0](v0.26.0...v0.27.0) (2026-10-03)

### ✨ Features

* **gateway:** add spec.a2a with Agent CR discovery ([#269](#269)) ([e707643](e707643))

### 🐛 Bug Fixes

* **gateway:** apply service type and annotations ([#260](#260)) ([1a78570](1a78570))

### 👷 CI

* **deps:** bump the gomod group with 4 updates ([#263](#263)) ([8c30df5](8c30df5))

### 📚 Documentation

* **agents:** add code readability guidelines ([#261](#261)) ([1b8157d](1b8157d))
* **agents:** add code readability guidelines ([#262](#262)) ([41c8e79](41c8e79))
* document gateway api crds and namespace label ([#258](#258)) ([a49a634](a49a634))
* fix install docs pinned version and stale claims ([#257](#257)) ([849e6f5](849e6f5))
* fix readme monitoring labels, configmap and status ([#256](#256)) ([31516bd](31516bd))
* fix removed and renamed CRD fields in docs ([#259](#259)) ([e81ea37](e81ea37))

### 🔧 Miscellaneous

* **deps:** bump claude-code 2.1.278 -> 2.1.280 ([#249](#249)) ([8888466](8888466))
* **deps:** bump claude-code 2.1.280 -> 2.1.283 ([#264](#264)) ([68d42bb](68d42bb))
* **deps:** bump claude-code 2.1.283 -> 2.1.285 ([#267](#267)) ([a940cb0](a940cb0))
* **deps:** bump infer CLI v0.205.3 -> v0.208.0 ([#250](#250)) ([3bcf0b1](3bcf0b1))
* **deps:** bump infer CLI v0.208.0 -> v0.218.0 ([#265](#265)) ([e08051d](e08051d))
* **deps:** bump infer CLI v0.218.0 -> v0.221.1 ([#266](#266)) ([a75538a](a75538a))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.27.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Gateway.spec.a2a with label-selector discovery of Agent CRs

1 participant