smtp-integrator docs: Charm architecture

Charm architecture

The SMTP Integrator charm fetches centralizes SMTP configuration and propagates it through a Juju integration.

Juju events

According to the Juju SDK: “an event is a data structure that encapsulates part of the execution context of a charm”.

For this charm, the following events are observed:

  1. config-changed: usually fired in response to a configuration change using the GUI or CLI. Action: validate the configuration and propagate the SMTP configuration through the relation.
  2. update-status: fired periodically. Action: propagate the SMTP configuration through the relation.
  3. smtp-relation-joined: Custom event for when a new SMTP relations joins. Action: write the SMTP details in the relation databag. The saml integration will share a secret id across the relation the requirer will be able to access to retrieve the password.
  4. smtp-legacy-relation-joined: Custom event for when a new legacy SMTP relations joins. Action: write the SMTP details in the relation databag. The saml-legacy integration will share the password across the relation.

Charm code overview

The src/charm.py is the default entry point for a charm and has the SmtpIntegratorOperatorCharm Python class which inherits from CharmBase.

CharmBase is the base class from which all Charms are formed, defined by Ops (Python framework for developing charms).

See more information in Charm.

The __init__ method guarantees that the charm observes all events relevant to its operation and handles them.