UpgradeGrantedEvent is emitted when the charm is allowed to upgrade the workload, but on K8s it's already upgraded when the charm receives UpgradCharmEvent and the other events that are fired later. For K8s, we need a different event, that tells that the upgrade was finished in the current unit and Juju can proceed to the next unit.
Solution
Created UpgradeFinishedEvent to be used to tell Juju to upgrade the next unit (by, for example, changing the partition field from the StatefulSet rolling update strategy). Logic for that was kept in the charms themselves for now to let them do some additional logic if needed.
Conditionals were added to trigger UpgradeRelationChangedEvent in the current unit on K8s, which avoid losing the event when we have only part of the units in the new charm revision.
Issue
UpgradeGrantedEvent
is emitted when the charm is allowed to upgrade the workload, but on K8s it's already upgraded when the charm receivesUpgradCharmEvent
and the other events that are fired later. For K8s, we need a different event, that tells that the upgrade was finished in the current unit and Juju can proceed to the next unit.Solution
Created
UpgradeFinishedEvent
to be used to tell Juju to upgrade the next unit (by, for example, changing thepartition
field from the StatefulSet rolling update strategy). Logic for that was kept in the charms themselves for now to let them do some additional logic if needed.Conditionals were added to trigger
UpgradeRelationChangedEvent
in the current unit on K8s, which avoid losing the event when we have only part of the units in the new charm revision.Added
PyYAML
tocharm-binary-python-packages
due to https://github.com/yaml/pyyaml/issues/601.