Allow creating topic using topic description from file #210
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.
Description
Allow the creation of a topic using configuration description from file
kafkactl describe topic my-topic -o json > my-topic-config.json kafkactl create topic my-topic-clone --file my-topic-config.json
Note that in the current implementation configuration from file would override the configuration provided via flag.
For example, if the file specifies that the topic has 10 partitions even if
--partition=5
flag is set, 10 partitions will be created.This might be confusing for the user.
I could have implemented the reading of the config file to happen in
cmd/create/create-topic.go
so the flags can override the configuration from the file, but it looked that it would be a bigger change in the project structure.I am happy to change it so flags override config file values if you think this is a better approach.
We can also return an error if some flags and
--file
flag are provided together, so it wont allow the user to provide--partition
and--file
simultaneously.But then we have the same problem with
--config
and--file
, unless we want to forbid the user to provide--config
flag (which will unnecessarily limit the functionality), we should establish order of precedence - flag over file or vice versa.Related to issue #202
Type of change
Please delete options that are not relevant.
Documentation
## [Unreleased]
section ofCHANGELOG.md
README.adoc
was updatedREADME.adoc