-
Notifications
You must be signed in to change notification settings - Fork 129
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
Database reconciler extracted to a separate library #1060
Comments
Updated the AC to also include the |
KIC doesn't use commands per se, as it's supplanting the deck UI, and all of what deck does really boils down to variants on its KIC also needs the We could maybe refactor to remove those type dependencies in KIC, but it probably wouldn't win us much in the short term. Those same packages are critical for the https://github.com/rainest/decklib is an example library repo, and rainest/kubernetes-ingress-controller#218 and rainest#123 show what this looks like in the projects that would depend on it. @GGabriele does that split look reasonable to you? IDK if there's anything ya'll would prefer to keep in the main deck repo or anything else you think should go in the lib.
Note: KIC still has a dependency on deck through KTF, as KTF has its own built-in miniature version of what KIC has to dump Kong config in diagnostics, AFAICT. While removing all tests does clear the deck dependency, I'm not sure how we actually want to go about that in KTF. We could refactor it to use the same library this would create. |
@rainest thanks for putting together this plan and providing these options! I think the option you are going with (keeping in decK only the CLI aspect of it) makes sense to me.
In an ideal world we would have extracted (from I'd request that @Tieske also take a look at this, since his work with APIOps may be potentially impacted too. |
Kong/go-database-reconciler#8 and Kong/go-database-reconciler#9 as tentative first steps in the actual new repo. https://github.com/Kong/go-database-reconciler/milestone/1 to track overall progress. Using multiple |
#1109 makes the changes in deck against the Kong/go-database-reconciler#9 draft. Assuming the GDR pull is merged as-is, the deck#1109 draft should just need to be updated with an actual version tag. Kong/kubernetes-ingress-controller#5156 makes the changes in KIC; ditto the version stuff. Kong/go-database-reconciler#10 is a basic test setup in the new repo that just runs the same tests as before by pulling in the deck CLI. Dunno if I can think of something more elegant--to actually do anything with the library (and thus test it) you need some equivalent of the deck CLI to call the library functions and provide them with input. We could make a non-CLI version that does so directly without cobra or whatever, but it wouldn't have much purpose other than avoiding the dependency ouroboros. That may be a valid reason in itself, but reusing the existing tests as a stopgap is simpler and achieves the same functional goal. Not sure if CI is caching results or what--it appears the tests generally worked except codecov, which fails due to a missing token. Not too big a concern. |
Problem Statement
deck
started out as a "database reconciler" and a definition for the declarative config format (aka "kong yaml" or "the deck format") that is now the API standard for Kong configuration. The scope of thedeck
tool has greatly expanded since then, however the "database reconciler" core is used as a library in certain contexts, particularly by KIC. This drift (between the broad scope of thedeck
CLI and the "database reconciler" library) has led to structural problems like the dependency cycle in #1050 (comment).Let's fix this structural problem - by making the incremental step of decomposing
deck
into the "top level CLI that relies on functionality implemented in libraries" and "the database reconciler library"Proposed Solution
Create a new library (@rainest coined the term "database reconciler" for this purpose) called
go-database-reconciler
and move the deckdiff
/sync
/dump
/reset
implementation thereto.The exact interface of the "database reconciler" is up to the implementer. The existing implementation suffers from tight coupling between the reconciliation logic and the filesystem R/W operations - whether this decoupling happens as part of this task or not is up to the person picking this up, whatever leads to better ROI in their view.
Additional Information
The
go-database-reconciler
name is open to change by the implementer.Acceptance Criteria
go-database-reconciler
repo/library exists and has a public programmatic interface exposing at least thedump
,sync
anddiff
operationsdeck
's cobra commandsdump
,sync
diff
andreset
switched to usinggo-database-reconciler
go.mod
dependency ongithub.com/Kong/deck
- it instead depends ongo-kong
andgo-database-reconciler
The text was updated successfully, but these errors were encountered: