kafka_client/v0¶
Usage¶
This relation interface describes the expected behavior of any charm claiming to be able to interface with a Kafka cluster as a client. For the majority of charms seeking to relate to a Kafka cluster, they will seek to do so as any of a producer, requirer or admin client.
Producers can expect their desired topic/wildcard to be granted
WRITE,DESCRIBE,CREATEtopic ACLs matching their application credentials upon relation. Producer clients then can create their own topics using whichever client-library they wish, setting any topic level configuration then (e.greplication-factorandpartitions).Consumers can expect to be granted ACLs for a specified topic with
READ,DESCRIBEon topic, andREADon a wildcard-suffixed consumer-group upon relation.Admins can expect to be granted super-user permissions for their application credentials upon relation.
Direction¶
flowchart LR
Requirer -- topic, extra-user-roles, consumer-group-prefix --> Provider
Provider -- topic, username, password, endpoints, consumer-group-prefix, zookeeper-uris --> Requirer
Behavior¶
Both the Requirer and the Provider need to adhere to the criteria, to be considered compatible with the interface.
Provider¶
Is expected to create an application
usernameandpasswordinside the kafka cluster when the requirer relates to the kafka cluster, using the SASL/SCRAM mechanism, stored in ZooKeeper.Is expected to delete an application
usernameandpasswordfrom the kafka cluster when the relation is removed.Is expected to provide a custom entity
entity-nameandentity-passwordinside the kafka cluster when the requirer relates to the kafka cluster when theentity-typefield is supplied.Is expected to delete a custom entity
entity-nameandentity-passwordfrom the kafka cluster when the relation is removed.Is expected to provide the
endpointsfield with a comma-seperated list of broker hostnames / IP addresses.Is expected to provide the
topicfield with the topic that was actually created.Can optionally provide the
consumer-group-prefixfield with the prefixed consumer groups, if requirerextra-user-rolesis includesconsumerCan optionally provide the
zookeeper-urisfield with a comma-seperated list of ZooKeeper server uris and Kafka cluster zNode, if the requirerextra-user-rolesincludesadmin
Requirer¶
Can optionally provide the
topicfield specifying the topic that the requirer charm needs permissions to create (forextra-user-roles=producer), or consume (forextra-user-roles=consumer).Is expected to tolerate that the Provider may ignore the
topicfield in some cases and instead use the topic name received.Is expected to provide the
extra-user-rolesfield specifying a comma-separated list of roles for the requested user or client application (betweenadmin,consumerandproducer).Can optionally provide the
extra-group-rolesfield specifying a comma-separated list of roles for the requested group (e.g.extra-group-roles=admin).Can optionally provide the
entity-typefield specifying the type of entity to request, instead of a topic.Can optionally provide the
entity-permissionsfield specifying the permissions for the requested entity.Can optionally provide the
consumer-group-prefixfield specifying the consumer-group-prefix that the requirer charm needs permissions to consume (forextra-user-roles=consumer).
Relation Data¶
Provider¶
Provider provides application credentials and server connection uris. It should be placed in the application databag.
Example¶
relation-info:
- endpoint: kafka_client
related-endpoint: kafka_client
application-data:
username: user123
password: Dy0k2UTfyNt2B13cfe412K7YGs07S4U7
endpoints: 10.141.78.155:9092,10.141.78.62:9092,10.141.78.186:9092
consumer-group-prefix: user123-
zookeeper-uris: 10.141.78.133:2181,10.141.78.50:2181,10.141.78.45:2181/kafka
Requirer¶
Requirer provides application role and topic. It should be placed in the application databag.
Example¶
relation-info:
- endpoint: kafka_client
related-endpoint: kafka_client
application-data:
extra-user-roles: consumer,producer
topic: special-topic
consumer-group-prefix: "my-consumer-group"