Skip to content

Commit f653f8e

Browse files
committed
organize alternatives
1 parent e61905f commit f653f8e

File tree

1 file changed

+20
-14
lines changed
  • keps/sig-api-machinery/4355-coordinated-leader-election

1 file changed

+20
-14
lines changed

keps/sig-api-machinery/4355-coordinated-leader-election/README.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ SIG Architecture for cross-cutting KEPs).
104104
- [Drawbacks](#drawbacks)
105105
- [Alternatives](#alternatives)
106106
- [Component instances pick a leader without a coordinator](#component-instances-pick-a-leader-without-a-coordinator)
107+
- [Component instances pick a leader without identity leases or a coordinator](#component-instances-pick-a-leader-without-identity-leases-or-a-coordinator)
107108
- [Future Work](#future-work)
108109
- [Infrastructure Needed (Optional)](#infrastructure-needed-optional)
109110
<!-- /toc -->
@@ -1021,28 +1022,38 @@ Why should this KEP _not_ be implemented?
10211022

10221023
## Alternatives
10231024

1024-
### Component instances pick a leader without a coordinator
1025+
When evaluating alternatives, note that if we decide in the future to improve
1026+
the algorithm, fix a bug in the algorithm, or change the criteria for how
1027+
leaders are elected, our decision on where to put the code has a huge impact our
1028+
how the change is rolled out.
10251029

1026-
The idea of this alternative is to elect a leader from a set of candidates
1027-
without a coordinated election controller.
1030+
For example, it will be much easier change in a controller in the kube-apiserver
1031+
than in client-go library code distributed to elected controllers, because once
1032+
it is distributed into controllers, especially 3rd party controllers, any change
1033+
requires updating client-go and then updating all controllers to that version of
1034+
client-go.
10281035

1029-
Some rough ideas of how this might be done:
1036+
### Component instances pick a leader without a coordinator
10301037

1031-
1. A candidates is picked at random to be an election coordinator, and the
1038+
- A candidates is picked at random to be an election coordinator, and the
10321039
coordinator picks the leader:
10331040
- Components race to claim the lease
1034-
- If a component claims the lease, the first thing it does is check to see if there is a better leader
1035-
- If it finds a better lease, it assigns the lease to that component instead of itself
1041+
- If a component claims the lease, the first thing it does is check the
1042+
identity leases to see if there is a better leader
1043+
- If it finds a better lease, it assigns the lease to that component instead
1044+
of itself
10361045

10371046
Pros:
1038-
10391047
- No coordinated election controller
1048+
10401049
Cons:
10411050

10421051
- All component instances must watch the identity leases
10431052
- All components must have the code to decide which component is the best leader
10441053

1045-
2. The candidates agree on the leader collectively
1054+
### Component instances pick a leader without identity leases or a coordinator
1055+
1056+
- The candidates communicate through the lease to agree on the leader
10461057
- Leases have "Election" and "Term" states
10471058
- Leases are first created in the "election" state.
10481059
- While in the "election" state, candidates self-nominate by updating the lease
@@ -1065,11 +1076,6 @@ Cons:
10651076
in the ecosystem with the bug must upgrade client-go and release to be fixed.
10661077
- More difficult to change/customize the criteria for which candidate is best.
10671078

1068-
If we decide in the future to shard controllers and wish to leverage coordinated
1069-
eader election to balance shards, it's much easier introduce the change in a
1070-
controller in the apiserver than in client-go library code distributed to
1071-
elected controllers.
1072-
10731079
## Future Work
10741080

10751081
- Controller sharding could leverage coordinated leader election to load balance

0 commit comments

Comments
 (0)