leaderelection

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLeaseDuration = 15 * time.Second
	DefaultRenewDeadline = 10 * time.Second
	DefaultRetryPeriod   = 2 * time.Second
)

Variables

This section is empty.

Functions

func New

func New(cfg *LeaderElectionConfig, onStart, onStop func()) (*leaderelection.LeaderElector, error)

New creates a new leader election manager

func Run

func Run(elector *leaderelection.LeaderElector, ctx context.Context)

Run starts the leader election process

Types

type LeaderElectionConfig

type LeaderElectionConfig struct {
	LeaseLockName      string        // Name of the lease lock
	LeaseLockNamespace string        // Namespace for the lease lock
	Identity           string        // Unique identity for the candidate
	LeaseDuration      time.Duration // Duration that non-leader candidates will wait to force acquire leadership
	RenewDeadline      time.Duration // Duration that the acting master will retry refreshing leadership before giving up
	RetryPeriod        time.Duration // Duration the LeaderElector clients should wait between tries of actions
}

LeaderElectionConfig represents the configuration for leader election

Jump to

Keyboard shortcuts

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