Skip to content

fix: make ListenerSet and GRPCRoute watches optional - #9583

Merged
zhaohuabing merged 3 commits into
envoyproxy:mainfrom
zhaohuabing:fix/optional-listenerset-grpcroute-crd-watches
Jul 29, 2026
Merged

fix: make ListenerSet and GRPCRoute watches optional#9583
zhaohuabing merged 3 commits into
envoyproxy:mainfrom
zhaohuabing:fix/optional-listenerset-grpcroute-crd-watches

Conversation

@zhaohuabing

@zhaohuabing zhaohuabing commented Jul 26, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

The Kubernetes provider watches, indexes and Lists ListenerSet and GRPCRoute unconditionally. When either CRD is absent, the manager's cache sync fails and Envoy Gateway crash-loops at startup:

error watching resources: no matches for kind "ListenerSet" in version "gateway.networking.k8s.io/v1"

Both kinds are in the Gateway API standard channel, but some managed Kubernetes offerings install only a curated subset of it and don't let users add the missing CRDs. As reported in #9517, GKE's managed gateway-api-crds addon (1.5.0-gke.3503) ships Gateway API v1.5 without listenersets and grpcroutes, because the GKE Gateway controller doesn't implement them; installing them out-of-band means a second owner for addon-lifecycle-managed CRDs and a guaranteed conflict later. The absent kind can't be used on those clusters anyway, so its absence should disable the feature, not take down the whole controller.

This is a rescope of #9517 to the scope agreed in its review thread; credit to @electricjesus for the original patch and to @dragon3 for the GKE data points.

The Kubernetes provider watches, indexes and Lists ListenerSet and
GRPCRoute unconditionally. When either CRD is absent, the manager's cache
sync fails and Envoy Gateway crash-loops at startup with:

  error watching resources: no matches for kind "ListenerSet" in version
  "gateway.networking.k8s.io/v1"

Both kinds are in the Gateway API standard channel, but some managed
Kubernetes offerings install only a curated subset of it and don't let
users add the missing CRDs. GKE's managed gateway-api-crds addon ships
Gateway API v1.5 without listenersets and grpcroutes, because the GKE
Gateway controller doesn't implement them; installing them out-of-band
means a second owner for addon-managed CRDs.

Guard both watches, their indexers, the reconcile-time processing and the
GRPCRoute predicate Lists behind a CRD existence check, restoring the
pre-envoyproxy#8365 behavior for these two kinds only. TLSRoute and
BackendTLSPolicy stay unconditional. When the CRDs are present, behavior
is unchanged; when one is absent, the controller starts and simply
doesn't serve that kind instead of taking down the whole controller. The
offline (file) provider keeps assuming all CRDs are present.

Existence is probed once at startup, so a CRD installed later is not
watched until the controller restarts, the same trade-off already
accepted for EnvoyProxy, TCPRoute and UDPRoute.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing
zhaohuabing requested a review from a team as a code owner July 26, 2026 00:44
@netlify

netlify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit e7195a0
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a6773527e1d9b0007a36490
😎 Deploy Preview https://deploy-preview-9583--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@zhaohuabing

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 62d0ab370f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

zirain
zirain previously approved these changes Jul 26, 2026
Comment thread internal/provider/kubernetes/controller.go
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.17391% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.64%. Comparing base (b1e2025) to head (e7195a0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/provider/kubernetes/controller.go 44.92% 21 Missing and 17 partials ⚠️
internal/provider/kubernetes/predicates.go 70.00% 4 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (52.17%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9583      +/-   ##
==========================================
- Coverage   75.65%   75.64%   -0.01%     
==========================================
  Files         253      254       +1     
  Lines       41879    41942      +63     
==========================================
+ Hits        31684    31729      +45     
- Misses       8064     8072       +8     
- Partials     2131     2141      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

TLSRoute graduated to the Gateway API standard channel in v1.5, so it is
subject to the same problem as ListenerSet and GRPCRoute: a cluster may
run a bundle that predates the graduation, or a managed offering may ship
only a curated subset of the standard channel, and the unconditional
watch then fails the manager's cache sync and crash-loops Envoy Gateway
at startup.

Guard the TLSRoute watch, its indexers, the reconcile-time processing and
the TLSRoute predicate List behind a CRD existence check, matching what
the previous commit does for ListenerSet and GRPCRoute. Also correct the
rationale comment: TCPRoute and UDPRoute are standard channel as of
Gateway API v1.6, they are not experimental-only.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing

Copy link
Copy Markdown
Member Author

/retest

@zhaohuabing
zhaohuabing requested review from a team, arkodg and zirain July 27, 2026 16:17
@kkk777-7

Copy link
Copy Markdown
Member

LGTM, thanks!

@zhaohuabing
zhaohuabing merged commit aec9ffd into envoyproxy:main Jul 29, 2026
63 of 67 checks passed
@zhaohuabing
zhaohuabing deleted the fix/optional-listenerset-grpcroute-crd-watches branch July 29, 2026 02:31
@dragon3

dragon3 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@zhaohuabing Thanks!

electricjesus added a commit to electricjesus/envoy-gateway that referenced this pull request Jul 29, 2026
envoyproxy#9583 landed the ListenerSet, GRPCRoute and TLSRoute guards this PR
originally proposed. What remains unguarded is BackendTLSPolicy, which is
the next kind the controller fails on for the same reason, so this PR is
now scoped to that alone.
HusseinKabbout pushed a commit to HusseinKabbout/gateway that referenced this pull request Jul 30, 2026
* fix: make ListenerSet and GRPCRoute watches optional (envoyproxy#8991)

The Kubernetes provider watches, indexes and Lists ListenerSet and
GRPCRoute unconditionally. When either CRD is absent, the manager's cache
sync fails and Envoy Gateway crash-loops at startup with:

  error watching resources: no matches for kind "ListenerSet" in version
  "gateway.networking.k8s.io/v1"

Both kinds are in the Gateway API standard channel, but some managed
Kubernetes offerings install only a curated subset of it and don't let
users add the missing CRDs. GKE's managed gateway-api-crds addon ships
Gateway API v1.5 without listenersets and grpcroutes, because the GKE
Gateway controller doesn't implement them; installing them out-of-band
means a second owner for addon-managed CRDs.

Guard both watches, their indexers, the reconcile-time processing and the
GRPCRoute predicate Lists behind a CRD existence check, restoring the
pre-envoyproxy#8365 behavior for these two kinds only. TLSRoute and
BackendTLSPolicy stay unconditional. When the CRDs are present, behavior
is unchanged; when one is absent, the controller starts and simply
doesn't serve that kind instead of taking down the whole controller. The
offline (file) provider keeps assuming all CRDs are present.

Existence is probed once at startup, so a CRD installed later is not
watched until the controller restarts, the same trade-off already
accepted for EnvoyProxy, TCPRoute and UDPRoute.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix: make the TLSRoute watch optional too

TLSRoute graduated to the Gateway API standard channel in v1.5, so it is
subject to the same problem as ListenerSet and GRPCRoute: a cluster may
run a bundle that predates the graduation, or a managed offering may ship
only a curated subset of the standard channel, and the unconditional
watch then fails the manager's cache sync and crash-loops Envoy Gateway
at startup.

Guard the TLSRoute watch, its indexers, the reconcile-time processing and
the TLSRoute predicate List behind a CRD existence check, matching what
the previous commit does for ListenerSet and GRPCRoute. Also correct the
rationale comment: TCPRoute and UDPRoute are standard channel as of
Gateway API v1.6, they are not experimental-only.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants