Leader Election Documentation (#728)
* Leader Election Documentation * update docs Co-authored-by: aswanson <anders_swanson@mcafee.com>
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
== Leader Election
|
||||
The Spring Cloud Kubernetes leader election mechanism implements the leader election API of Spring Integration using a Kubernetes ConfigMap.
|
||||
|
||||
<TBD>
|
||||
Multiple application instances compete for leadership, but leadership will only be granted to one.
|
||||
When granted leadership, a leader application receives an `OnGrantedEvent` application event with leadership `Context`.
|
||||
Applications periodically attempt to gain leadership, with leadership granted to the first caller.
|
||||
A leader will remain a leader until either it is removed from the cluster, or it yields its leadership.
|
||||
When leadership removal occurs, the previous leader receives `OnRevokedEvent` application event.
|
||||
After removal, any instances in the cluster may become the new leader, including the old leader.
|
||||
|
||||
To include it in your project, add the following dependency.
|
||||
====
|
||||
Fabric8 Leader Implementation
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-fabric8-leader</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
|
||||
To specify the name of the configmap used for leader election use the following property.
|
||||
====
|
||||
[source]
|
||||
----
|
||||
spring.cloud.kubernetes.leader.config-map-name=leader
|
||||
----
|
||||
====
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# Role to which leader election this instance will participate
|
||||
spring.cloud.kubernetes.leader.role=world
|
||||
# Configmap to which leader election metadata will be saved
|
||||
spring.cloud.kubernetes.leader.config-map-name=leader
|
||||
|
||||
Reference in New Issue
Block a user