Merge pull request #42232 from honkiko/fix-leader-transitions-always-zero

Automatic merge from submit-queue (batch tested with PRs 42126, 42130, 42232, 42245, 41932)

fix LeaderTransitions always zero

on leader transition, LeaderTransitions is increased to 1, but
then cleared to zero by next renew.

External monitoring system may watch LeaderTransitions and rely
on it's facticity.
pull/6/head
Kubernetes Submit Queue 2017-03-02 02:07:25 -08:00 committed by GitHub
commit f3a0fd4e86
1 changed files with 1 additions and 0 deletions

View File

@ -253,6 +253,7 @@ func (le *LeaderElector) tryAcquireOrRenew() bool {
// here. Let's correct it before updating.
if oldLeaderElectionRecord.HolderIdentity == le.config.Lock.Identity() {
leaderElectionRecord.AcquireTime = oldLeaderElectionRecord.AcquireTime
leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions
} else {
leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions + 1
}