-
Notifications
You must be signed in to change notification settings - Fork 40
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(utils): add ClearUnmatchingDeprecations function to align configs #473
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #473 +/- ##
==========================================
+ Coverage 54.04% 55.15% +1.11%
==========================================
Files 71 71
Lines 5599 5691 +92
==========================================
+ Hits 3026 3139 +113
+ Misses 1954 1935 -19
+ Partials 619 617 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
f2e13bd
to
6e4a200
Compare
df36ae0
to
a7dc20e
Compare
836ef7b
to
012122b
Compare
Thanks @Prashansa-K for the review. For now I've changed this PR back to draft because I've found a couple of issues. |
012122b
to
78a21e4
Compare
78a21e4
to
6cc5ee3
Compare
Ok the corresponding PR is green and I think I've tackled the edge cases I've discovered (in the tests in this PR and the other one: Kong/go-database-reconciler#145 ). I think it's ready to be reviewed again. |
The requested changes were addressed and incorporated.
73b25d6
to
f936e44
Compare
I did some important changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments on Go style etc.
When a new plugin configuration is sent that contains information about some deprecated fields in order to produce correct diff we need to align the API response with given config. KAG-5577
f936e44
to
c010578
Compare
…configs PR Review - styling fixes
I tested these changes locally with an openid plugin (deck file added here)and noticed the following: On gateway 3.8.1.0
These fields don't have any translate_backwards or replaced_with property in the schema. So, not applicable with this change. However, on Konnect, I noticed some diffs:
decK and reconciler logic remains same for Konnect as far as I know. Is there anything different schema-wise for Konnect that could be causing this? |
@Prashansa-K it seems that it's a well known Koko issue. The reason why you see these diffs in Konnect is that Lua-CP and Koko treat |
83a17ed
to
20c546e
Compare
… align configs Fix for when nil config values are passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments. Other than that this looks solid.
One thought though: could we add an integration test that checks against the schema we receive from Gateway? Perhaps we can use
go-kong/kong/plugin_service.go
Line 64 in 5236d86
func (s *PluginService) GetFullSchema(ctx context.Context, |
RunWhenKong()
to constrain the versions against which we run these tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified the "important changes" described in the summary, LGTM
…configs PR Review - styling fixes, switch to integration tests
@pmalek I've made the changes according to your comments and I've switched to calling Kong API in tests (didn't know we can do this from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits about the testing.
…configs PR Review - test styling fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
Summary
When a new plugin configuration is sent that contains information about some deprecated fields in order to produce
correct diff we need to align the API response with given config.
Description
This PR aims to align the configs by doing two things:
ClearUnmatchingDeprecations
fillConfigRecord
More details can be found in the functions documentation.
Important changes:
nil
values are preserved and not changed whenfillConfigRecord
is run. Previously a configcluster_max_redirections: null
would be "filled" withcluster_max_redirections: 5
ifcluster_max_redirections
had a default value of 5 defined. Right now sending explicit null preserves that. This reverts the change introduced in: https://github.com/Kong/go-kong/pull/309/files#diff-af8350ebad15aeeb0a2561433d1d0907140df8e5b8267a0d0f05bb53d0d53fcbR221-R249fillConfigRecord
will not try to fill deprecated fields in that configfillConfigRecord
will not populate the new fields that are linked to that deprecated fieldRelated PRs:
KAG-5577