devshawn / kafka-gitops

🚀Manage Apache Kafka topics and generate ACLs through a desired state file.
https://devshawn.github.io/kafka-gitops
Apache License 2.0
322 stars 71 forks source link

Possible to use this against an existing cluster and not destroy it? #31

Closed jurschel closed 4 years ago

jurschel commented 4 years ago

So given that we have existing clusters is it even possible to use the tool just to create topics?

devshawn commented 4 years ago

Yes, you can use the tool to just create new topics. You can run kafka-gitops with the --no-delete flag, and it will only plan/apply creates and updates.

Example state file new-topics.yaml:

topics:
  my-new-topic:
    partitions: 6
    replication: 3

Run against the cluster:

kafka-gitops -f new-topics.yaml --no-delete plan -o plan.json
kafka-gitops -f new-topics.yaml --no-delete apply -p plan.json

Over time, you can slowly start to add existing topics (and services, if desired) to your state file until we have implemented import functionality (#13).

jurschel commented 4 years ago

Ah ok thanks for the response. I was about to reply with the below. I did see something about the --no-delete option just hadn't gotten to it yet.

I see in your documentation that applying this against a cluster is destructive if you don't have all the topics in the state file. Shouldn't you leave any built-in topics like _confluent.support.metrics, _confluent_offsets and _schemas alone completely?

jurschel commented 4 years ago

That worked. Good work. Now I'm going to get my central repository for topics going!

devshawn commented 4 years ago

Glad to hear that worked, @jurschel!

It would probably be a good idea to completely ignore those specific topics, but we've chosen so far to just define them as-is in our state file.

You can also use the topic blacklist option to have the tool ignore topics on a prefixed basis:

settings:
  topics:
    blacklist:
      prefixed:
        - _confluent

Good luck with getting your central repository going! Let me know if you have questions! 😄