✨ release leader election lease on manager cancellation by joelanford · Pull Request #1689 · operator-framework/operator-controller
This means that if the pod is shutdown properly, it will give up its lease. Is that right? What are the risks?
Correct, and if it is not shut down properly, it likely won't give up its lease because giving up its lease is the last thing it does.
The main risk is that we go out of our way to run a separate goroutine that does leader-y things whose lifetime goes beyond that of the manager. If we do that, then the manager will release the lease, some other process could assume leadership, and the our other goroutine and the new leader will be duking it out.
I don't think that's a big risk though.