feat: add deck file format command for deck/dbless conversion#1978
Open
feat: add deck file format command for deck/dbless conversion#1978
deck file format command for deck/dbless conversion#1978Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1978 +/- ##
==========================================
- Coverage 32.58% 32.26% -0.32%
==========================================
Files 77 78 +1
Lines 6903 7014 +111
==========================================
+ Hits 2249 2263 +14
- Misses 4474 4571 +97
Partials 180 180 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3fa0fe1 to
81b2253
Compare
Adds a new 'deck file format' subcommand that converts Kong configuration
files between decK format and Kong DBless format.
Usage:
decK
DBless
The two formats differ in consumer-group entity representation:
- decK: plugins nested under consumer_groups[*].plugins,
memberships nested under consumers[*].groups
- DBless: plugins in top-level consumer_group_plugins array,
memberships in top-level consumer_group_consumers array
decK, delegates to deckformat.ConvertDBless from go-apiops.
DBless, implements the inverse transformation locally.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
81b2253 to
0d15c26
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Ref: https://github.com/Kong/go-apiops/blob/main/deckformat/fileformat.md
Kong configuration files exist in two incompatible formats — decK (human-friendly, intended for manual editing) and DBless (Kong's backup/restore format, used with
kong config db_export/kong config db_import). Users working across both toolchains need a way to convert between them without manual editing.What
Adds a new
deck file formatsubcommand:Supports
-o / --output-file(default: stdout) and--format yaml|json.How
The two formats differ primarily in how consumer-group entities are represented:
consumer_groups[*].pluginsconsumer_group_pluginsarrayconsumers[*].groupsconsumer_group_consumersarraydeckformat.ConvertDBless()fromgo-apiops, which already implements this transformation.convertDeckToDBless()as the inverse: it extracts nested plugins and group memberships back into top-level arrays, adding the appropriateconsumer_group/consumerforeign-key fields.