Event '<container>-pebble-ready'

Event > List of events > Lifecycle events > <container>-pebble-ready

Source: ops.PebbleReadyEvent

The <container>-pebble-ready event is emitted once the Pebble sidecar container has started and a socket is available. There is one <container>-pebble-ready event for each container defined in metadata.yaml. This event allows the charm to configure how services should be launched.

This event is specific to Kubernetes sidecar charms and is only ever fired on Kubernetes deployments.

The pebble-ready event doesn’t guarantee the workload container is still up. For example, if you manually kubectl patch during (for example) install, then you may receive this event after the old workload is down but before the new one is up. For this reason it’s essential, even in pebble-ready event handlers, to guard with Container.can_connect() to check that the socket is up. Do note that this is a point-in-time check, so just because can_connect() returns True doesn’t mean it will still return True at a later time.

Observing this event in ops

When using the ops library, you can observe the event like you would any other:


The PebbleReadyEvent class is a subclass of WorkloadEvent, so it exposes a workload attribute which returns the ops.Container instance the event is associated with.

Last updated 2 months ago.