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
,CREATE
topic 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-factor
andpartitions
). - Consumers can expect to be granted ACLs for a specified topic with
READ
,DESCRIBE
on topic, andREAD
on a wildcard-suffixed consumer-group upon relation. - Admins can expect to be granted super-user permissions for their application credentials upon relation.
flowchart LR
Requirer -- topic, extra-user-roles, consumer-group-prefix --> Provider
Provider -- topic, username, password, endpoints, consumer-group-prefix, zookeeper-uris --> Requirer
Both the Requirer and the Provider need to adhere to the criteria, to be considered compatible with the interface.
- Is expected to create an application
username
andpassword
inside 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
username
andpassword
from the kafka cluster when the relation is removed. - Is expected to provide the
endpoints
field with a comma-seperated list of broker hostnames / IP addresses. - Is expected to provide the
topic
field with the topic that was actually created. - Can optionally provide the
consumer-group-prefix
field with the prefixed consumer groups, if requirerextra-user-roles
is includesconsumer
- Can optionally provide the
zookeeper-uris
field with a comma-seperated list of ZooKeeper server uris and Kafka cluster zNode, if the requirerextra-user-roles
includesadmin
- Is expected to provide the
extra-user-roles
field specifying a comma-separated list of roles for the client application (betweenadmin
,consumer
andproducer
). - Can optionally provide the
topic
field 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
topic
field in some cases and instead use the topic name received. - Can optionally provide the
consumer-group-prefix
field specifying the consumer-group-prefix that the requirer charm needs permissions to consume (forextra-user-roles=consumer
).
Provider provides application credentials and server connection uris. It should be placed in the application databag.
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 provides application role and topic. It should be placed in the application databag.
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"