Hook

In Juju, a hook is a notification from the controller agent through the unit agent to the charm that the internal representation of Juju has changed in a way that requires a reaction from the charm so that the unit’s state and the controller’s state can be reconciled.

In the charm SDK, in Ops, Juju hooks are translated into Ops events = ‘events’, specifically, into classes that inherit from HookEvent.

Contents:

List of hooks

Source

  • <action name>-action
  • <container>-pebble-change-updated
  • <container>-pebble-check-failed (starting with Juju 3.6)
  • <container>-pebble-check-recovered (starting with Juju 3.6)
  • <container>-pebble-custom-notice
  • <container>-pebble-ready
  • <endpoint>-relation-broken
  • <endpoint>-relation-changed
  • <endpoint>-relation-created
  • <endpoint>-relation-departed
  • <endpoint>-relation-joined
  • <storage>-storage-attached
  • <storage>-storage-detaching
  • collect-metrics
  • config-changed
  • install
  • leader-deposed
  • leader-elected
  • leader-settings-changed
  • meter-status-changed
  • post-series-upgrade (removed starting with Juju 4)
  • pre-series-upgrade (removed starting with Juju 4)
  • remove
  • secret-changed

Triggered by Juju on a secret’s observer when the secret’s owner changes the secret’s contents.

  • secret-expired

Currently supported only for charm secrets.

Triggered by Juju on a secret’s owner when a secret’s expiration time elapses.

  • secret-remove

Currently supported only for charm secrets.

Triggered by Juju on a secret’s owner when one of the secret’s revisions can be removed.

  • secret-rotate

Currently supported only for charm secrets.

Triggered by Juju on a secret’s owner when the secret’s rotation policy elapses .

  • start
  • stop
  • update-status
  • upgrade-charm

Contributors: @anvial, @hmlanigan, @ppasotti , @simonrichardson, @tmihoc

Last updated 4 days ago. Help improve this document in the forum.