Closed samugi closed 4 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 59.94%. Comparing base (
c64125c
) to head (6dbf5df
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
not sure why the linter got mad
not sure why the linter got mad
https://github.com/Kong/go-kong/actions/runs/10493904848/job/29068947573?pr=463 Looks like the linter was updated some day but it did not notify us
@samugi https://github.com/Kong/go-kong/pull/464 This should solve the linter issues and align linter version to be the same on CI and locallly
For visibility:
I do not fully understand why there is even this FillPluginsDefaults
. I think it is wrong that the defaults or null
s are filled to config (prior sending them to Kong API). If user has .yaml
file, the tool should not invent any fields in it, and send only those that user has specified, e.g. even when user has specified field: ~
(aka null), that should be sent to kong, but nothing else. Kong, at least the Lua CP will fill the defaults, and do proper thing.
Now if tool itself needs these to be filled (e.g. for easier diffing or something), it is another question, but that should not affect what is sent to wire to Kong API (provided that Koko API works the same).
This of course means that the tool should also never use PATCH
or POST
, just PUT
and DELETE
and GET
. And if it needs for this to invent anything, I would say only the id
but that you need to take some care with. E.g. multiple runs should probably produce same id (or primary key).
That said, we can first stop filling nulls
(as it fixes the immediate issue of deprecated shorthand precedence), and perhaps later (in other PR) stop filling defaults
.
That said, we can first stop filling nulls (as it fixes the immediate issue of deprecated shorthand precedence), and perhaps later (in other PR) stop filling defaults.
Stop filling default nulls, you mean? Active null should still be accepted
That said, we can first stop filling nulls (as it fixes the immediate issue of deprecated shorthand precedence), and perhaps later (in other PR) stop filling defaults.
Stop filling default nulls, you mean? Active null should still be accepted
yes @mheap that is correct, this change is intended to only apply to auto-filled defaults
Note: this appears to be breaking the decK diff output (where now all nulls show up as diffs) - probably expected given the change here, because of this, so we might need to do it differently (?), e.g. like @bungle says, by preventing default to be filled at all when the config is sent to Kong (and keep the behavior unchanged for diffs). I suspect that change must be done ~in decK~ somewhere else instead of here.
second attempt: https://github.com/Kong/go-database-reconciler/pull/133
when filling defaults, the existing logic sets
nil
on missing fields, but in Kong Gateway explicitnil
s result in the corresponding fields to be unset, causing problems such as: KAG-5157This change removes any unset fields that don't have a default from the configuration instead of explicitly setting them to
nil
.@reviewers
: could this be a breaking change? I tested it in decK and it seems to work but I'm worried about other projects using this lib. An alternative would be creating another utils function with the new behavior (which I think would require updating at leastdeck
,go-database-reconciler
and probably kubernetes-ingress-controller), but if we're fairly confident the func is only used while interacting with decK then it might be considered safe enough.Searching occurrences.
For more details see: KAG-5210