I'm not sure what actually happens if we don't have a leader for a particular application. In theory, I think everything should be fine. The first unit that wants to be the leader can be.
I think the subtlety here is that if there is no leader and a unit asks if it is the leader, it will be told yes. So if we remove leadership from a unit, and then that same unit asks if it is the leader, it may well reclaim the leadership.
I agree that the is-leader hook should start returning false if the unit is being destroyed.
I'm not sure what actually happens if we don't have a leader for a particular application. In theory, I think everything should be fine. The first unit that wants to be the leader can be.
I think the subtlety here is that if there is no leader and a unit asks if it is the leader, it will be told yes. So if we remove leadership from a unit, and then that same unit asks if it is the leader, it may well reclaim the leadership.
I agree that the is-leader hook should start returning false if the unit is being destroyed.