multi: add leader check to the healthcheck monitor

This commit extends our healtcheck with an optional leader check. This
is to ensure that given network partition or other cluster wide failure
we act as soon as possible to avoid a split-brain situation where a new
leader is elected but we still hold onto our etcd client.
This commit is contained in:
Andras Banki-Horvath committed 2024-08-01 19:04:10 +02:00
1 parent 7784d6abf6
commit 8e0534f756
8 files changed
+121 -12

No files matched your search

+4 -1
View File
@@ -19,8 +19,11 @@ type LeaderElector interface {
// Resign resigns from the leader role, allowing other election members
// to take on leadership.
Resign() error
Resign(ctx context.Context) error
// Leader returns the leader value for the current election.
Leader(ctx context.Context) (string, error)
// IsLeader returns true if the caller is the leader.
IsLeader(ctx context.Context) (bool, error)
}