Skip to content

Commit

Permalink
[DPE-2097] Trigger relation changed when pod get restarted (#67)
Browse files Browse the repository at this point in the history
* Trigger relation changed when pod get restarted

* Fix integration tests
  • Loading branch information
arturo-seijas committed Jun 14, 2023
1 parent 1c89860 commit 8bebfaa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def _redis_pebble_ready(self, event) -> None:
if not isinstance(self.unit.status, ActiveStatus):
event.defer()
return
# In the event of a pod restart on the same node the upgrade event is not fired.
# The IP might change, so the data needs to be propagated
for relation in self.model.relations[REDIS_REL_NAME]:
relation.data[self.model.unit]["hostname"] = socket.gethostbyname(self.current_master)

def _upgrade_charm(self, event: UpgradeCharmEvent) -> None:
"""Handle the upgrade_charm event.
Expand Down

0 comments on commit 8bebfaa

Please sign in to comment.