Closed zmraul closed 2 years ago
Integration tests seem to be failing because timing issues.
Looks good, also would be nice to change the language from master to primary (feel free to do this in a different PR).
Yeah, this will be changed, thanks for the remainder. Redis will update terminology in the future to change this as well. But at the moment some sentinel/redis commands still refer to the master replica.
Issue
This PR addresses Jira ticket DPE-620, and Issue #50
Scaling events and pod reschedules now will check if they need to update the leader information on related apps.
Solution
Redis charm can be related to an application. If a failover happens, or the pod gets rescheduled (IP change) the related application should get updated information. To do so, extra logic has been added to handle scaling and pod deletion situations.
If a pod goes down, Juju will issue a
upgrade_charm
sequence of events. There are two situations:peer_relation_changed
for the rest of the units. At that moment, all will update information on the redis relation.peer
databag. After this, the rest of the units will receivepeer_relation_changed
, and the leader unit will be tasked with updating the application databag.When a pod goes down, and
upgrade_charm
executes, pebble_ready for sentinel has not happened yet. For this reason it is necessary to connect to a different sentinel instance to check for failover status.Release Notes
src/charm.py
.upgrade_charm
will now check for failovers and update accordingly.peer_relation_changed
now makes sure a failover is not in progress before updating information.check_master
: now sentinel is used to know if master is down. The host can also be used to ask a different sentinel instance about the cluster status.Testing
test_application_data_update_after_failover