File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,10 @@ The `bootstrap` subcommand creates apply topic configs from the existing topics
145145cluster. This can be used to "import" topics not created or previously managed by topicctl.
146146The output can be sent to either a directory (if the ` --output ` flag is set) or ` stdout ` .
147147
148+ By default, this does not include internal topics such as ` __consumer_offsets ` .
149+ If you would like to have these topics included,
150+ pass the ` --allow-internal-topics ` flag.
151+
148152#### check
149153
150154```
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ type bootstrapCmdConfig struct {
2121 outputDir string
2222 overwrite bool
2323
24+ allowInternalTopics bool
25+
2426 shared sharedOptions
2527}
2628
@@ -52,6 +54,11 @@ func init() {
5254 false ,
5355 "Overwrite existing configs in output directory" ,
5456 )
57+ bootstrapCmd .Flags ().BoolVar (
58+ & bootstrapConfig .allowInternalTopics ,
59+ "allow-internal-topics" ,
60+ false ,
61+ "Include topics that start with __ (typically these are internal topics)" )
5562
5663 addSharedConfigOnlyFlags (bootstrapCmd , & bootstrapConfig .shared )
5764 bootstrapCmd .MarkFlagRequired ("cluster-config" )
@@ -92,5 +99,6 @@ func bootstrapRun(cmd *cobra.Command, args []string) error {
9299 bootstrapConfig .excludeRegexp ,
93100 bootstrapConfig .outputDir ,
94101 bootstrapConfig .overwrite ,
102+ bootstrapConfig .allowInternalTopics ,
95103 )
96104}
Original file line number Diff line number Diff line change @@ -208,6 +208,7 @@ func (c *CLIRunner) BootstrapTopics(
208208 excludeRegexpStr string ,
209209 outputDir string ,
210210 overwrite bool ,
211+ allowInternalTopics bool ,
211212) error {
212213 topicInfoObjs , err := c .adminClient .GetTopics (ctx , topics , false )
213214 if err != nil {
@@ -226,7 +227,7 @@ func (c *CLIRunner) BootstrapTopics(
226227 topicConfigs := []config.TopicConfig {}
227228
228229 for _ , topicInfo := range topicInfoObjs {
229- if strings .HasPrefix (topicInfo .Name , "__" ) {
230+ if ! allowInternalTopics && strings .HasPrefix (topicInfo .Name , "__" ) {
230231 // Never include underscore topics
231232 continue
232233 } else if ! matchRegexp .MatchString (topicInfo .Name ) {
You can’t perform that action at this time.
0 commit comments