leadership

package
v4.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentLeader

func CurrentLeader() string

CurrentLeader returns the current cluster leader node, if the current agent instance has successfully participated in the election process and been notified of the leader.

func RequestLeaderNotification

func RequestLeaderNotification(v1Client corev1.CoreV1Interface) (<-chan bool, func(), error)

RequestLeaderNotification provides a simple way for monitors to only send metrics from a single instance of the agent. It wraps client-go's leaderelection tool, and uses the node name as the identifier in the election process, but this is scoped by namespace as well so there can be at most one agent pod per namespace per node for the logic to work. Calling this function starts the election process if it is not already running and returns a channel that gets fed true when this instance becomes leader and subsequently false if the instance stops being the leader for some reason, at which point the channel could send true again and so on. All monitors that need leader election will share the same election process. There is no way to stop the leader election process once it starts.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL