You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new `resourceLock` type of `coordinatedleases`, and `CoordinatedLeaseLock`
339
-
implementation of `resourcelock.Interface` will be added to client-go that:
334
+
A new controller `tools/leaderelection/leasecandidate` will be added to client-go that:
340
335
341
336
- Creates LeaseCandidate Lease when ready to be Leader
342
337
- Renews LeaseCandidate lease infrequently (once every 300 seconds)
343
-
- Watches its LeaseCandidate lease for the `coordination.k8s.io/pending-ack` annotation and updates to remove it. When the annotation is removed, the `renewTime` is subsequently updated.
344
-
338
+
- Watches its LeaseCandidate lease for the updates to the `pingTime` field. If
339
+
the `pingTime` field is later than `renewTime`, it signals that the
340
+
`LeaseCandidate`should be renewed and the `renewTime` is subsequently
341
+
updated.
345
342
- Watches Leader Lease, waiting to be elected leader by the Coordinated Election
346
343
Controller
347
344
- When it becomes leader:
348
345
- Perform role of active component instance
349
346
- Renew leader lease periodically
350
-
- Stop renewing if lease is marked `spec.endOfTerm: true`
347
+
- Stop renewing if lease field `spec.preferredHolder` is non nil
351
348
- If leader lease expires:
352
-
- Shutdown (yielding leadership) and restart as a candidate component instance
349
+
- Yield leadership and return to acting as a candidate component instance. For certain components, this may involve shutting down and restarting.
353
350
354
351
```mermaid
355
352
flowchart TD
356
353
A[Started] -->|Create LeaseCandidate Lease| B
357
354
B[Candidate] --> |Elected| C[Leader]
358
355
C --> |Renew Leader Lease| C
359
-
C -->|End of Term / Leader Lease Expired| D[Shutdown]
360
-
D[Shutdown] -.-> |Restart| A
356
+
C -->|Better Candidate Available / Leader Lease Expired| D[Yield Leadership]
357
+
D[Yield Leadership] -.-> |Shutdown/Restart if necessary| A
361
358
```
362
359
363
360
### Renewal Interval and Performance
@@ -366,10 +363,12 @@ The leader lease will have renewal interval and duration (2s and 15s). This is s
366
363
For component leases, keeping a short renewal interval will add many unnecessary writes to the apiserver.
367
364
The component leases renewal interval will default to 5 mins.
368
365
369
-
When the leader lease is marked as end of term or available, the coordinated leader election controller will
370
-
add an annotation to all component lease candidate objects (`coordination.k8s.io/pending-ack`) and wait up to 5 seconds.
371
-
During that time, components must update their component lease to remove the annotation.
372
-
The leader election controller will then pick the leader based on its criteria from the set of component leases that have ack'd the request.
366
+
When the leader lease is marked as end of term or available, the coordinated
367
+
leader election controller will update the `pingTime` field of all component
368
+
lease candidate objects and wait up to 5 seconds. During that time, components
369
+
will update their component lease `renewTime`. The leader election controller
370
+
will then pick the leader based on its criteria from the set of component leases
371
+
that have ack'd the request.
373
372
374
373
### Strategy
375
374
@@ -484,27 +483,18 @@ type CoordinatedLeaseStrategy string
484
483
485
484
// CoordinatedLeaseStrategy defines the strategy for picking the leader for coordinated leader election.
0 commit comments