I’ve managed to come a long way with implementing relations, but now when I’m implementing more complex charms with many relations, I have found myself ending up in a bit of a mess in my code. Using various of events which may or may not be right. I definitely need to step back a bit to understand more about relations and look for help.
First, I would love to know about some up-to-date documentation that covers all the different states/hooks that are executed as part of relations where information is found about:
- When (under what conditions) they are fired and what data is available.
- What responsibilities the developer have in the different hooks vs what juju takes care of.
- Why a developer should/must implement them.
- Examples on how a developer should implement them.
I’ve studied a few charms, and I see most people are using either “on_relation_created”, “on_relation_joined”, “on_relation_changed”. But I can’t see any pattern on what people put in them. It seems very “free-form” at the moment. E.g. You pick one and be happy about it?
More questions arise around “peer” relations. Are they different? Do they follow a different state transition diagram? What data is available etc…
Big thanx for pointing me further to docs.