Skip to content

Commit

Permalink
Update leaderless lease info
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefftree committed Jun 6, 2024
1 parent 50641e8 commit 5b1ebac
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions keps/sig-api-machinery/4355-coordinated-leader-election/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,19 @@ and this can be done via the `spec.Strategy` field in a Lease.
The `Strategy` field signals to the coordinated leader election controller the
appropriate algorithm to use when selecting leaders.

We will allow the Coordinated Leader Election controller to create a Lease
without a holder. If there are no candidate objects, the `Strategy` field will
remain empty to indicate that the `Lease` is not managed by the CLE controller.
Otherwise the strategy will always default to `MinimumCompatibilityVersion`. The
`Lease` may also be updated by a third party to the desired `spec.Strategy` if
an alternate strategy is preferred. This may be done either by the candidates,
users, or additional controllers.
We will allow for the existence of a lease without a holder. This will allow
`Strategy` to be injected and preserved for leases that may not want to use the
default selected by CLE. If there are no candidate objects, the `Strategy` field
will remain empty to indicate that the `Lease` is not managed by the CLE
controller. Otherwise the strategy will always default to
`MinimumCompatibilityVersion`. The `Lease` may also be created or updated by a
third party to the desired `spec.Strategy` if an alternate strategy is
preferred. This may be done either by the candidates, users, or additional
controllers.

Releasing a `Lease` will involve resetting the holderIdentity to `nil` instead
of deletion. This will preserve `Strategy` when a `Lease` object is released and
reacquired by another candidate.

#### Alternative for Strategy

Expand Down Expand Up @@ -525,9 +531,6 @@ type LeaseCandidateSpec struct {
// CanLeadLease indicates the name of the lease that the candidate may lead
CanLeadLease string

// Strategy indicates the preferred strategy for the coordinated leader election controller to use.
Strategy CoordinatedLeaseStrategy `json:"strategy,omitempty" protobuf:"string,6,opt,name=strategy"`

// FIELDS DUPLICATED FROM LEASE

// leaseDurationSeconds is a duration that candidates for a lease need
Expand All @@ -545,12 +548,6 @@ type LeaseCandidateSpec struct {
Each LeaseCandidate lease may only lead one lock. If the same component wishes to lead many leases,
a separate LeaseCandidate lease will be required for each lock.

If the `LeaseCandidate` objects do not agree on a value for the Strategy, we will have an ordering priority.
For instance, we define `NewestCompatibilityVersion` > `OldestCompatibilityVersion`. This means that if
a subset of candidates have `OldestCompatibilityVersion` and and subset have `NewestCompatibilityVersion`,
coordinated leader election will pick `NewestCompatibilityVersion`. In order for `OldestCompatibilityVersion` to be used,
all `LeaseCandidate` objects must publish the same `Strategy`.

### Comparison of leader election

| | Lease Based Leader Election | Coordinated Leader Election |
Expand Down

0 comments on commit 5b1ebac

Please sign in to comment.