mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
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.
This commit is contained in:
parent
fbe2d15f8c
commit
38b95f0c38
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user