Charmed Zookeeper
- Canonical
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 53 | 29 Nov 2021 | |
latest/candidate | 56 | 29 Nov 2021 | |
latest/beta | 56 | 29 Nov 2021 | |
latest/edge | 98 | 20 Apr 2023 | |
latest/edge | 85 | 21 Oct 2022 | |
latest/edge | 65 | 09 Feb 2022 | |
latest/edge | 52 | 29 Nov 2021 | |
3/stable | 149 | 23 Oct 2024 | |
3/candidate | 149 | 21 Oct 2024 | |
3/beta | 149 | 21 Oct 2024 | |
3/edge | 152 | 17 Dec 2024 |
juju deploy zookeeper --channel 3/stable
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
charms.zookeeper.v0.zookeeper_provider
-
- Last updated 12 Jul 2022
- Revision Library version 0.2
ZooKeeperProvider class and methods.
ZooKeeperProvider
handles the provider side abstraction for ZooKeeper client relations.
It abstracts the updating the ZK quorum of authorised users and their ACLs during
zookeeper_relation_updated/joined
and zookeeper_relation_broken
events.
During these events, ACLs and user zNodes are updated on the leader for all related applications, client and peer relation data is set with the necessary information on both side, and new users are added to the unit's JAAS config file, whereupon which a rolling restart of the ZooKeeper service is triggered.
Example usage for ZooKeeperProvider
:
class ZooKeeperCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.provider = ZooKeeperProvider(self)
self.restart = RollingOpsManager(self, relation="restart", callback=self._on_start)
def _on_start(self, event):
# event is passed here to check for RelationBrokenEvents
# in which case that relation will be removed
users = self.provider.build_jaas_users(event=event)
# get_passwords()
# set_zookeeper_auth_config(passwords, users)
# restart_snap_service()
Index
class ZooKeeperProvider
Methods
ZooKeeperProvider. __init__( self , charm )
ZooKeeperProvider. app_relation( self )
Description
Gets the current ZK peer relation. None
ZooKeeperProvider. client_relations( self )
Description
Gets the relations for all related client applications. None
ZooKeeperProvider. relation_config( self , relation: Relation , event )
Gets the auth config for a currently related application.
Arguments
the relation you want to build config for
the corresponding event.
If passed and is RelationBrokenEvent
, will skip and return None
Returns
Dict containing relation username
, password
, chroot
, acl
None
if RelationBrokenEvent
is passed as event
ZooKeeperProvider. build_jaas_users( self , event )
Builds the necessary user strings to add to ZK JAAS config files.
Arguments
used for checking RelationBrokenEvent
Returns
Newline delimited string of JAAS users from relation data
ZooKeeperProvider. relations_config( self , event )
Gets auth configs for all currently related applications.
Arguments
used for checking RelationBrokenEvent
Returns
Dict of key = relation_id
, value = relations_config()
for all related apps
ZooKeeperProvider. build_acls( self , event )
Gets ACLs for all currently related applications.
Arguments
used for checking RelationBrokenEvent
Returns
Dict of chroot
s with value as list of ACLs for the chroot
ZooKeeperProvider. relations_config_values_for_key( self , key: str , event )
Grabs a specific auth config value from all related applications.
Arguments
used for checking RelationBrokenEvent
Returns
Set of all app values matching a specific key from relations_config()
ZooKeeperProvider. update_acls( self , event )
Compares leader auth config to incoming relation config, applies necessary add/update/remove actions.
Arguments
used for checking RelationBrokenEvent
ZooKeeperProvider. apply_relation_data( self , event )
Updates relation data with new auth values upon concluded client_relation events.
Arguments
used for checking RelationBrokenEvent