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: fill config values and defaults in shorthand fields #458

Merged
merged 4 commits into from
Aug 5, 2024

Conversation

Prashansa-K
Copy link
Collaborator

@Prashansa-K Prashansa-K commented Aug 5, 2024

As of now, deprecated fields are renamed to shorthand_fields in all schemas, as per the conventions. Till now, we do not fill any values for these fields while attempting to fill config records for plugins. This creates a visualisation problem in decK. Everytime, a deck diff or deck sync command is issued, it shows that the deprecated field values are changed and need to be updated, thus running an unnecessary update process each time and also confusing end users.

Check Kong/deck#1251 for details.

This fix attempts to fill defaults for the shorthand_fields, retaining their values, if passed. Also, since shorthand_fields take priority over normal/nested fields in the gateway, if any changes are detected in shorthand_fields, it is backfilled to nested fields as well.

@Prashansa-K Prashansa-K requested review from a team as code owners August 5, 2024 08:46
@CLAassistant
Copy link

CLAassistant commented Aug 5, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-commenter
Copy link

codecov-commenter commented Aug 5, 2024

Codecov Report

Attention: Patch coverage is 77.55102% with 11 lines in your changes missing coverage. Please review.

Project coverage is 59.79%. Comparing base (a9ec2d5) to head (3a072ec).

Files Patch % Lines
kong/utils.go 77.55% 6 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #458      +/-   ##
==========================================
+ Coverage   59.61%   59.79%   +0.17%     
==========================================
  Files          71       71              
  Lines        4408     4455      +47     
==========================================
+ Hits         2628     2664      +36     
- Misses       1166     1172       +6     
- Partials      614      619       +5     
Flag Coverage Δ
2.1 36.25% <77.55%> (+0.43%) ⬆️
2.2 48.64% <77.55%> (+0.29%) ⬆️
2.3 49.27% <77.55%> (+0.29%) ⬆️
2.4 49.31% <77.55%> (+0.29%) ⬆️
2.5 49.31% <77.55%> (+0.29%) ⬆️
2.6 49.31% <77.55%> (+0.29%) ⬆️
2.7 50.86% <77.55%> (+0.13%) ⬆️
2.8 50.99% <77.55%> (+0.27%) ⬆️
3.0 54.43% <77.55%> (-0.47%) ⬇️
3.1 56.74% <77.55%> (+0.21%) ⬆️
3.2 56.74% <77.55%> (+0.21%) ⬆️
3.3 56.74% <77.55%> (+0.21%) ⬆️
3.4 59.10% <77.55%> (+0.18%) ⬆️
3.5 56.92% <77.55%> (+0.20%) ⬆️
3.6 56.22% <77.55%> (-0.49%) ⬇️
community 44.01% <77.55%> (+0.34%) ⬆️
enterprise 58.22% <77.55%> (+0.19%) ⬆️
integration 59.79% <77.55%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Prashansa-K
Copy link
Collaborator Author

Added a unit test for the recent changes @GGabriele.

@pmalek pmalek linked an issue Aug 5, 2024 that may be closed by this pull request
Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

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

Some minor comments here and there.

kong/utils.go Show resolved Hide resolved
kong/utils.go Show resolved Hide resolved
kong/utils.go Show resolved Hide resolved
kong/utils.go Outdated Show resolved Hide resolved
kong/utils.go Show resolved Hide resolved
Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

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

Other than the remaining bits, LGTM.

kong/utils.go Outdated Show resolved Hide resolved
kong/utils.go Outdated Show resolved Hide resolved
kong/utils.go Show resolved Hide resolved
@Prashansa-K Prashansa-K requested a review from pmalek August 5, 2024 12:09
As of now, deprecated fields are renamed to shorthand_fields in all
schemas, as per the conventions. Till now, we do not fill any
values for these fields while attempting to fill config records for
plugins. This creates a visualisation problem in decK. Everytime, a
deck diff or deck sync command is issued, it shows that the deprecated
field values are changed and need to be updated, thus running an
unnecessary update process each time and also confusing end users.
Check #1251: Kong/deck#1251 for clarity.

This fix attempts to fill defaults for the shorthand_fields, retaining
their values, if passed. Also, since shorthand_fields take priority
over normal/nested fields in the gateway, if any changes are detected in
shorthand_fields, it is backfilled to nested fields as well.
@pmalek pmalek force-pushed the fix/deprecated-configs-fill branch from 68f01de to 3a072ec Compare August 5, 2024 13:40
@Prashansa-K Prashansa-K merged commit e54b4ed into main Aug 5, 2024
79 checks passed
@Prashansa-K Prashansa-K deleted the fix/deprecated-configs-fill branch August 5, 2024 13:47
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.

deck always update rate-limiter plugin config even no changes
4 participants