When a master is deleted, The termination could take a while
which means there is a possibility of two pods with role=master
to exist. If a pod trigger happens in this situation, Unnecessary
reconcilation happens as the controller can assume thats its
a corrupt state.
This commit essentially eliminates this case by removing this label
before electing a new master and thus ensuring that there is only
master all the time. We can be sure that the new master won't be
the currently being deleted pod as we check for the deletion timestamp
When a master is deleted, The termination could take a while which means there is a possibility of two pods with
role=master
to exist. If a pod trigger happens in this situation, Unnecessary reconcilation happens as the controller can assume thats its a corrupt state.This commit essentially eliminates this case by removing this label before electing a new master and thus ensuring that there is only master all the time. We can be sure that the new master won't be the currently being deleted pod as we check for the deletion timestamp