Skip to content

fix: read L4 routes and ReferenceGrant as v1 instead of the older versions - #2839

Merged
AlinsRan merged 2 commits into
apache:masterfrom
AlinsRan:feat/l4route-v1
Aug 11, 2026
Merged

fix: read L4 routes and ReferenceGrant as v1 instead of the older versions#2839
AlinsRan merged 2 commits into
apache:masterfrom
AlinsRan:feat/l4route-v1

Conversation

@AlinsRan

@AlinsRan AlinsRan commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Gateway API 1.6 promoted the L4 routes to v1 and deprecated v1alpha2, but the controller still registers, watches, indexes and validates all three through sigs.k8s.io/gateway-api/apis/v1alpha2. Every informer re-list logs:

Warning: The v1alpha2 version of TCPRoute has been deprecated and will be removed in a future release of the API. Please upgrade to v1.

That warning is the visible half. The real problem is that in the 1.6 standard channel CRDs, v1alpha2 is served: false:

CRD v1 v1alpha2 (standard) v1alpha2 (experimental)
tcproutes served, storage not served served, deprecated
udproutes served, storage not served served, deprecated
tlsroutes served, storage not served served, deprecated

So for anyone installing the standard channel, HasAPIResource in setupGatewayAPIControllers finds nothing, and the TCPRoute, UDPRoute and TLSRoute reconcilers are silently skipped — L4 routing does not work at all. make install-gateway-api installs the experimental channel, which still serves v1alpha2, which is why CI never caught this.

Solution

Commit 1 — L4 routes to v1. Switch every reference to apis/v1:

  • scheme registration (internal/manager/run.go) and the CRD probe (internal/manager/controllers.go)
  • field indexers, the three reconcilers, the translator, the status writer, the route adapters
  • the TCPRoute/UDPRoute validating webhooks — paths move from /validate-gateway-networking-k8s-io-v1alpha2-* to -v1-*, config/webhook/manifests.yaml is regenerated to match, and the hand-written e2e webhook manifest is synced

The v1alpha2 rule and status types are already type aliases of their v1 counterparts, so this is a version switch rather than a behavior change.

Commit 2 — ReferenceGrant to v1. 1.6 also added a v1 ReferenceGrant. This one is not urgent: v1beta1 is not deprecated and remains the storage version, so nothing is broken today. But every symbol used from apis/v1beta1 exists in apis/v1, and the API server converts stored objects on the way out, so reading it through the version the API now leads with is free.

User manifests that still declare an older version keep working wherever the installed CRDs serve it, because the API server converts them before they reach the informer. Examples, e2e manifests and the docs support table now use v1.

One schema difference worth noting: v1 tightens TCPRouteSpec.Rules from MaxItems=16 to MaxItems=1. The translator iterates rules and is unaffected, and every manifest in this repo already carries a single rule.

Breaking change

L4 routing now requires Gateway API 1.6 or later, the first release that serves the v1 versions of TCPRoute, UDPRoute and TLSRoute. Makefile already pins GATEAY_API_VERSION ?= v1.6.0.

Verification

  • go build ./..., go vet ./..., gofmt -l clean
  • make lint — 0 issues
  • go test ./internal/... ./pkg/... — all packages pass

Gateway API 1.6 promoted the L4 routes to v1 and deprecated v1alpha2, but
the controller still registered, watched, indexed and validated all three
through sigs.k8s.io/gateway-api/apis/v1alpha2.

That is not just a deprecation warning on every informer re-list. In the
1.6 standard channel CRDs the v1alpha2 version is `served: false`, so for
anyone who installs that channel the CRD probe in setupGatewayAPIControllers
finds nothing and the TCPRoute, UDPRoute and TLSRoute reconcilers are
silently skipped -- L4 routing does not work at all. The project's own
Makefile installs the experimental channel, which still serves v1alpha2,
which is why CI never caught it.

Switch every reference to apis/v1: scheme registration, the CRD probe, the
field indexers, the three reconcilers, the translator, the status writer,
the route adapters and the TCPRoute/UDPRoute validating webhooks. The
v1alpha2 rule and status types are already aliases of their v1
counterparts, so this is a version switch rather than a behavior change.

The webhook paths move from /validate-gateway-networking-k8s-io-v1alpha2-*
to -v1-*, and config/webhook/manifests.yaml is regenerated to match; the
hand-written e2e webhook manifest is synced by hand.

Manifests that still declare gateway.networking.k8s.io/v1alpha2 keep
working wherever the installed CRDs serve that version, since the API
server converts them before they reach the informer. Examples, e2e
manifests and the docs support table now use v1.

BREAKING CHANGE: L4 routing now requires Gateway API 1.6 or later, which is
the first release that serves the v1 versions of TCPRoute, UDPRoute and
TLSRoute.
Gateway API 1.6 added a v1 version of ReferenceGrant. Unlike the L4 routes,
v1beta1 is not deprecated and remains the storage version, so nothing is
broken today -- this is only about reading the resource through the version
the API now leads with.

Every symbol the controller used from apis/v1beta1 (ReferenceGrant, its
Spec/From/To types, Group, Namespace, RouteReasonRefNotPermitted) exists in
apis/v1, and the API server converts stored v1beta1 objects on the way out,
so watches, the ReferenceGrant-to-route mappers and the cross-namespace
permission checks behave identically.

Also refresh the Gateway API spec link in the docs, which still pointed at
the 1.3 reference.
@AlinsRan AlinsRan changed the title fix: read TCPRoute/UDPRoute/TLSRoute as v1 instead of v1alpha2 fix: read L4 routes and ReferenceGrant as v1 instead of the older versions Aug 10, 2026
AlinsRan added a commit to api7/api7-ingress-controller that referenced this pull request Aug 10, 2026
…sions

Sync of apache/apisix-ingress-controller#2839.

Gateway API 1.6 promoted TCPRoute, UDPRoute and TLSRoute to v1 and
deprecated v1alpha2, but the controller still registered, watched, indexed
and validated all three through sigs.k8s.io/gateway-api/apis/v1alpha2.

That is not only a deprecation warning on every informer re-list. In the
1.6 standard channel CRDs the v1alpha2 version is `served: false`, so for
anyone who installs that channel the CRD probe in setupGatewayAPIControllers
finds nothing and the three L4 reconcilers are silently skipped -- L4
routing does not work at all. Our own Makefile installs the experimental
channel, which still serves v1alpha2, which is why CI never caught it.
Envoy Gateway hit the same failure with TLSRoute (envoyproxy/gateway#8326).

Switch every reference to apis/v1: scheme registration, the CRD probe, the
field indexers, the three reconcilers, the translator, the status writers
for both the APISIX and API7 EE providers, the route adapters and the
TCPRoute/UDPRoute validating webhooks. The v1alpha2 rule and status types
are already aliases of their v1 counterparts, so this is a version switch
rather than a behavior change.

ReferenceGrant moves to v1 as well. That one is not urgent -- v1beta1 is
not deprecated and remains the storage version -- but every symbol used
from apis/v1beta1 exists in apis/v1, so reading it through the version the
API now leads with is free.

The webhook paths move from /validate-gateway-networking-k8s-io-v1alpha2-*
to -v1-*, config/webhook/manifests.yaml is regenerated to match, and the
hand-written e2e webhook manifest is synced by hand.

Manifests that still declare an older version keep working wherever the
installed CRDs serve it, since the API server converts them before they
reach the informer. Examples, e2e manifests and the docs support table now
use v1.

BREAKING CHANGE: L4 routing now requires Gateway API 1.6 or later, which is
the first release that serves the v1 versions of TCPRoute, UDPRoute and
TLSRoute.
@AlinsRan
AlinsRan merged commit 85d3551 into apache:master Aug 11, 2026
32 of 33 checks passed
@AlinsRan
AlinsRan deleted the feat/l4route-v1 branch August 11, 2026 02:06
AlinsRan added a commit to AlinsRan/apisix-ingress-controller that referenced this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants