Skip to content

charmed-kubernetes/charm-interface-peer-discovery

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Overview

This interface is practically only a placeholder peer interface which provides no special functionality, except access to the 'private-address' field of all peers which is provided by juju implicitly.

Usage

Peers

By using the peer-discovery interface on a peer type relation, you will get notified when peers join or leave.

@when('relation-name.joined ')
def connected(peers):
    hosts = peers.units()
    if data_changed('my-peers', hosts):
        do_something(hosts)
    remove_state('ssh-peers.joined')

The interface sets those states for you:

  • *.connected
  • *.joined
  • *.departed

connected is set while at least one peer is connected.

joined and departed states will clear at the end of the hook invocation. They behave more like events than states.

The units() method only works inside of the relation hook which triggered the handler.

About

Peer discovery charm for juju

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%