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

chore(refactor): streamline logic for HTTPRoute configuration generation #6741

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

programmer04
Copy link
Member

@programmer04 programmer04 commented Nov 28, 2024

What this PR does / why we need it:

Function GenerateKongRouteFromTranslation(...) is used only for validation (the fact that it is used for both flavors for validation leads to confusion). Furthermore, code related to expression routes is used only here + in tests.

This PR renames GenerateKongExpressionRoutesFromTranslation(...) to GenerateKongExpressionRoutesFromTranslationForValidation(...) and uses it explicitly in admission validation. It removes GenerateKongRouteFromTranslation(...) and does some opportunistic refeactors cleanups. Also, it gets rid of redundant parameters, helpers, etc.

Which issue this PR fixes:

Discovered during work on

Special notes for your reviewer:

Changes in that PR improve the situation but don't make it perfect. I'm proposing creating a separate issue to track the effort of unifying logic for generating actual configuration sent to Kong Gateway and configuration used only for validation for expression routes. There is test coverage, so it seems to be a safe change.

@programmer04 programmer04 added area/maintenance Cleanup, refactoring, and other maintenance improvements that don't change functionality. refactor labels Nov 28, 2024
@programmer04 programmer04 added this to the KIC v3.4.x milestone Nov 28, 2024
@programmer04 programmer04 self-assigned this Nov 28, 2024
@programmer04 programmer04 force-pushed the simplify-httproute branch 2 times, most recently from 3483871 to aefa653 Compare November 28, 2024 15:23
@programmer04 programmer04 marked this pull request as ready for review November 28, 2024 15:41
@programmer04 programmer04 requested a review from a team as a code owner November 28, 2024 15:41
@programmer04 programmer04 enabled auto-merge (squash) November 28, 2024 15:42
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.8%. Comparing base (f8a7606) to head (ae04588).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
internal/admission/validation/gateway/httproute.go 96.2% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #6741     +/-   ##
=======================================
- Coverage   77.1%   76.8%   -0.3%     
=======================================
  Files        211     211             
  Lines      25299   25349     +50     
=======================================
- Hits       19517   19491     -26     
- Misses      4773    4837     +64     
- Partials    1009    1021     +12     

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

@randmonkey
Copy link
Contributor

Please wait for #6711 (and further #6727 for expression based routes) that will change the translation of HTTPRoute to services.

@programmer04
Copy link
Member Author

Thanks for the info @randmonkey I have stacked changes for propagating named routes (#6582), but I suppose they should be applied after your change will be merged

@programmer04 programmer04 marked this pull request as draft November 29, 2024 12:07
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 16, 2024
@programmer04 programmer04 force-pushed the simplify-httproute branch 2 times, most recently from 9443c17 to a6d1e07 Compare December 16, 2024 18:24
@programmer04 programmer04 marked this pull request as ready for review December 16, 2024 18:24
@programmer04 programmer04 enabled auto-merge (squash) December 16, 2024 18:24
@randmonkey randmonkey mentioned this pull request Dec 17, 2024
34 tasks
@programmer04 programmer04 added release/not-required this is not a hard requirement for the release, it can be considered a "nice to have" nice-to-have labels Dec 17, 2024
@pmalek
Copy link
Member

pmalek commented Dec 19, 2024

@programmer04 There are some conflicts here to resolve after the above mentioned PRs merged. Do you still intend to merge this one?

@pmalek pmalek removed this from the KIC v3.4.x milestone Dec 20, 2024
@pmalek
Copy link
Member

pmalek commented Dec 20, 2024

Removing from 3.4 as that has already shipped and we're most likely not going to backport this. Correct me if I'm wrong @programmer04.

@programmer04 programmer04 marked this pull request as draft December 20, 2024 13:36
auto-merge was automatically disabled December 20, 2024 13:36

Pull request was converted to draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maintenance Cleanup, refactoring, and other maintenance improvements that don't change functionality. nice-to-have refactor release/not-required this is not a hard requirement for the release, it can be considered a "nice to have" size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants