Package: kafka-ease
Kafka EaseAutomating the creation of topics and ACLs is a common task for Kafka administrators. This repository contains a set of utilities to automate these tasks.Create a topic with a given number of partitions and replication factorCreate ACLs for a given topicSee thedocumentationfor more information.ContentsKafka EaseContentsGetting startedInstallationrequirements.txtPip installHow to useFile formatValidate configurationApply configurationHelpChangelogGetting startedInstallationrequirements.txtTo install the library from the GitLab package registry, write the following lines in the filerequirements.txt:kafka-ease==[VERSION]Pip installTo install the library, run the following command:pipinstallkafka-ease==[VERSION]CheckPEP 440for version schemes and version specifiers.How to useFile formatThe file format is YAML or JSON. The file must contain a list of topics and a list of ACLs.# acl.yamltopics:-name:topic.namenum_partitions:1replication_factor:1cleanup_policy:deleteretention_days:7acls:-resource_type:TOPICresource_name:topic.nameprincipal:User:kafka-userhost:"*"operation:READpermission_type:ALLOWpattern_type:LITERAL{"topics":[{"name":"topic.name","num_partitions":1,"replication_factor":1,"cleanup_policy":"delete","retention_days":7}],"acls":[{"resource_type":"TOPIC","resource_name":"topic.name","principal":"User:kafka-user","host":"*","operation":"READ","permission_type":"ALLOW","pattern_type":"LITERAL"}]}Topicsname: Topic namenum_partitions: Number of partitionsreplication_factor: Replication factorcleanup_policy: Cleanup policy (delete,compact)retention_days: Delete retention daysACLsresource_type: Resource type (UNKNOWN,ANY,CLUSTER,TOPIC,DELEGATION_TOKEN,GROUP,TRANSACTIONAL_ID)resource_name: Resource nameprincipal: Principal (User:,Group:)host: Host (*)operation: Operation (ANY,ALL,READ,WRITE,CREATE,DELETE,ALTER,DESCRIBE,CLUSTER_ACTION,DESCRIBE_CONFIGS,ALTER_CONFIGS,IDEMPOTENT_WRITE)permission_type: Permission type (ANY,DENY,ALLOW)pattern_type: Pattern type (ANY,MATCH,LITERAL,PREFIXED)Validate configurationkafka-easeapply-facl.yaml--only-validateExpected output:Validating file acl.yaml...
File: acl.yaml
YAML file detected
2 topics found.
2 ACLs found.
File acl.yaml is valid.Apply configurationkafka-easeapply-facl.yaml\--kafka-brokerskafka:9093\--security-protocolSASL_PLAINTEXT\--sasl-mechanismSCRAM-SHA-256\--sasl-usernamekafka-admin\--sasl-passwordSECRETExpected output:Applying file...
Kafka brokers: kafka:9093
Security protocol: SASL_PLAINTEXT
SASL mechanism: SCRAM-SHA-256
SASL username: kafka-admin
SASL password: ***************
File: acl.yaml
YAML file detected
1 topics found.
1 ACLs found.
Topic topic.name updated
Removing old ACLs 3
ACL User:kafka-user synced
File synced successfully.Helpkafka-easeapply--helpExpected output:Usage: kafka-ease apply [OPTIONS]

  Apply configuration file with topics and ACL to Kafka.

Options:
  --kafka-brokers TEXT            Kafka server to connect to use.
  --security-protocol [PLAINTEXT|SASL_PLAINTEXT]
                                  Kafka Security protocol to use.
  --sasl-mechanism [PLAIN|SCRAM-SHA-256|SCRAM-SHA-512]
                                  SASL mechanism to use.
  --sasl-username TEXT            SASL username to use.
  --sasl-password TEXT            SASL password to use.
  -f, --file TEXT                 File path to validate
  --only-validate                 Only validate the file
  --help                          Show this message and exit.Changelog1.0.0 (2023-09-20)Initial release of Kafka Ease1.0.1 (2023-09-20)Fix packaging error1.0.2 (2023-09-20)Fix minor bugs