@@ -16,12 +16,15 @@ limitations under the License.
16
16
17
17
// Package leaderelection implements leader election of a set of endpoints.
18
18
// It uses an annotation in the endpoints object to store the record of the
19
- // election state.
19
+ // election state. This implementation does not guarantee that only one
20
+ // client is acting as a leader (a.k.a. fencing).
20
21
//
21
- // This implementation does not guarantee that only one client is acting as a
22
- // leader (a.k.a. fencing). A client observes timestamps captured locally to
23
- // infer the state of the leader election. Thus the implementation is tolerant
24
- // to arbitrary clock skew, but is not tolerant to arbitrary clock skew rate.
22
+ // A client observes timestamps captured locally to infer the state of the
23
+ // leader election. Thus the implementation is tolerant to arbitrary clock
24
+ // skew, but is not tolerant to arbitrary clock skew rate. Timestamp(renew time)
25
+ // is not meaningful if it was collected on another machine. The implementation
26
+ // of this client only acts on locally collected timestamps and cannot rely on
27
+ // the accuracy of timestamp in the record for correctness.
25
28
//
26
29
// However the level of tolerance to skew rate can be configured by setting
27
30
// RenewDeadline and LeaseDuration appropriately. The tolerance expressed as a
@@ -104,7 +107,15 @@ type LeaderElectionConfig struct {
104
107
105
108
// LeaseDuration is the duration that non-leader candidates will
106
109
// wait to force acquire leadership. This is measured against time of
107
- // last observed ack.
110
+ // last observed ack. A client needs to wait a full LeaseDuration without
111
+ // observing a change to the record before it can attempt to take over even
112
+ // when a client with a different identity against the record's starts and
113
+ // the renew time in the record is older than LeaseDuration. A.k.a., when
114
+ // all clients are shutdown and after at least a LeaseDuration, clients
115
+ // started with different identities against the record's must wait a full
116
+ // LeaseDuration before acquiring a lock. Thus LeaseDuration should be as
117
+ // short as possible to avoid a possible long waiting. LeaseDuration is 15
118
+ // seconds in core Kubernetes components.
108
119
LeaseDuration time.Duration
109
120
// RenewDeadline is the duration that the acting master will retry
110
121
// refreshing leadership before giving up.
0 commit comments