-
Notifications
You must be signed in to change notification settings - Fork 591
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 dataplane components (client, synchronizer, and parser) #2296
Conversation
2cc29ca
to
ce22962
Compare
ce22962
to
c18862a
Compare
6eabf63
to
0ef9bf5
Compare
0ef9bf5
to
31fa138
Compare
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 file name bikeshedding and a dead link.
Can you clarify the "make it easier to later add options to parser" refactor/indicate what we should look at that isn't just reorganization? What did we do before (I think this is "add new parameters to NewCacheBasedProxyWithStagger()
and friends) and how do we handle that after this change?
a6f0a43
to
28e90f7
Compare
This makes it easier to add runtime configuration options to the parser to enable options while building.
Before options were passed as function parameters and would need to be passed through several layers of function calls (options like the logger for instance). Now the parser is a struct with the logger (again, for instance) as an attribute. Future iterations will now be able to feed options from the |
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.
A more concrete condensed pseudocode example would still help understanding the refactor better, but eh, looks reasonable enough, I suppose that can wait til a PR for #1492.
What this PR does / why we need it:
This significantly refactors the
internal/dataplane
code the original motivation was to make it easier to later add options to parser for #1492.Most notably this PR splits what was previous called the
Proxy
interface, which had both the aspects of a high level data-plane API client and a synchronization server for the data-plane. It's responsibilities are now split intodataplane.KongClient
anddataplane.Synchronizer
and while the diff is large, the code has mainly just been moved around and the resulting objects are much easier to read and understand.High level refactoring notes:
Proxy
interface no longer exists, it's concerns have been separated into adataplane.Client
and adataplane.Synchronizer
dataplane.KongClient
is now responsible for updates to the dataplane:internal/dataplane/sendconfig/common_workflows.go
has been consumedinternal/dataplane/parser
is now an object which can be configured to allow attributes to affect runtime logic instead of having to continually add more function parameters and feed them down the call chain, this will make it easier to add options that are specific to some resource types, or otherwise influence parsing with lighter weight PRsWhich issue this PR fixes
Resolves #2295
Special notes for your reviewer:
No user facing changes, and despite the fact that the diff looks large functionality was just moved not added.