Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: generate routes with hostname match only when GRPCRoute rule does not have matches #4512

Merged
merged 2 commits into from
Aug 17, 2023

Conversation

randmonkey
Copy link
Contributor

@randmonkey randmonkey commented Aug 15, 2023

What this PR does / why we need it:

generate routes matching hostnames only when a GRPCRoute rule does not contain a match, covering both traditional and expression routes.

Which issue this PR fixes:

fixes #4154
Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@randmonkey randmonkey requested a review from a team as a code owner August 15, 2023 10:22
@randmonkey randmonkey self-assigned this Aug 15, 2023
@randmonkey randmonkey added this to the KIC v2.12.0 milestone Aug 15, 2023
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Patch coverage: 95.4% and project coverage change: +0.1% 🎉

Comparison is base (c397107) 67.7% compared to head (667bff4) 67.8%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #4512     +/-   ##
=======================================
+ Coverage   67.7%   67.8%   +0.1%     
=======================================
  Files        161     161             
  Lines      18845   18904     +59     
=======================================
+ Hits       12769   12831     +62     
- Misses      5315    5317      +2     
+ Partials     761     756      -5     
Files Changed Coverage Δ
internal/dataplane/parser/translate_grpcroute.go 78.5% <82.3%> (+1.9%) ⬆️
internal/dataplane/parser/translators/grpcroute.go 97.0% <100.0%> (+0.6%) ⬆️
...rnal/dataplane/parser/translators/grpcroute_atc.go 93.5% <100.0%> (+0.6%) ⬆️

... and 5 files with indirect coverage changes

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

Copy link
Contributor

@rainest rainest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog entry is missing. Probably:

- Create routes that match any service and method for GRPCRoute rules with no
  matches.
  [#4512](https://github.com/Kong/kubernetes-ingress-controller/issues/4512)

under fixes.

The spec technically does also allow 0-rule GRPCRoutes, but it's not clear to me how we should handle those. Upstream configuration and plugin configuration (via filters) are both handled at the rule level (though our implementation still allows setting plugins at the resource level).

If we do generate configuration from those, we'd need to handle some cases directly in ingressRulesFromGRPCRoute(), since the current generator loops over rules and would generate nothing from a 0-rule GRPCRoute. Given the ambiguous purpose I think we defer that from here and see if we can get a response from upstream.

internal/dataplane/parser/translators/grpcroute.go Outdated Show resolved Hide resolved
internal/dataplane/parser/translators/grpcroute_atc.go Outdated Show resolved Hide resolved
Copy link
Contributor

@rainest rainest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty hostname rule is indeed in place most of the time, although it shouldn't be. Unclear how we wound up with a mix, but it's precedent enough to not fix here if we prefer: #4526

@randmonkey randmonkey merged commit 13c8d70 into main Aug 17, 2023
31 checks passed
@randmonkey randmonkey deleted the fix/grpcroute_zero_match branch August 17, 2023 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPCRoute tranlator cannot handle wildcard rule
2 participants