Skip to content

gateway-api: fix supported route kind validation#870

Merged
arkodg merged 1 commit intoenvoyproxy:mainfrom
datawire:laustin/conformance-invalid-route-kind
Jan 6, 2023
Merged

gateway-api: fix supported route kind validation#870
arkodg merged 1 commit intoenvoyproxy:mainfrom
datawire:laustin/conformance-invalid-route-kind

Conversation

@LanceEa
Copy link
Copy Markdown
Contributor

@LanceEa LanceEa commented Jan 6, 2023

The logic for validating allowedRoute.kinds of a listener was overwriting the SupportedKinds when multiple kinds are configured. This caused the GatewayInvalidRouteKind conformance test to fail.

Items addressed:

  • refactored validateAllowedRoutes to reduce nesting
  • fixed validateAllowedRoutes logic so it collects all of the SupportedKinds before setting them on the listener
  • provide additional context to user to help identify which RouteKind is invalid on a listener
  • updated unit tests for translator based on new expected output
  • added additional unit test case for translator to test for when multiple Kinds are added which includes valid and invalid Kinds.

Fixes #782

The logic for validating `allowedRoute.kinds` of a listener was
overwriting the SupportedKinds when multiple kinds are configured.
This caused the `GatewayInvalidRouteKind` conformance test to fail.

Items addressed:
- refactored `validateAllowedRoutes` to reduce nesting
- fixed `validateAllowedRoutes` logic so  it collects all of the
SupportedKinds before setting them on the listener
- provide additional context to user to help identify which RouteKind
is invalid on a listener
- updated unit tests for translator based on new expected output
- added additional unit test case for translator to test for when
multiple Kinds are added which includes valid and invalid Kinds.

Signed-off-by: Lance Austin <laustin@datawire.io>
@LanceEa LanceEa requested a review from a team as a code owner January 6, 2023 22:02
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #870 (3590c77) into main (a0be2d8) will decrease coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #870      +/-   ##
==========================================
- Coverage   63.93%   63.85%   -0.09%     
==========================================
  Files          51       51              
  Lines        6863     6869       +6     
==========================================
- Hits         4388     4386       -2     
- Misses       2201     2206       +5     
- Partials      274      277       +3     
Impacted Files Coverage Δ
internal/gatewayapi/validate.go 90.86% <100.00%> (+0.34%) ⬆️
internal/provider/kubernetes/controller.go 46.02% <0.00%> (-1.01%) ⬇️
internal/provider/kubernetes/helpers.go 77.04% <0.00%> (-0.82%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

Good catch, LGTM ! 🚀

@arkodg arkodg merged commit 5b79437 into envoyproxy:main Jan 6, 2023
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.

Enable GatewayInvalidRouteKind conformance test

3 participants