multileader

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Cooperative leader election, where a fixed number of controllers can act as the leaders simultaneously.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enable        bool
	Namespace     string
	Name          string
	LeaseDuration time.Duration
	RenewDeadline time.Duration
	RetryPeriod   time.Duration
	NumLeaders    int
	Identity      string // for testing only
}

func (*Config) SetupOptions

func (config *Config) SetupOptions(fs *pflag.FlagSet, prefix string, component string, defaultNumLeaders int)

type Elector

type Elector struct {
	Identity string
	// contains filtered or unexported fields
}

func NewElector

func NewElector(
	component string,
	logger logrus.FieldLogger,
	clock clock.Clock,
	config *Config,
	client k8s.Client,
	metricsClient metrics.Client,
) (*Elector, error)

func (*Elector) Run

func (elector *Elector) Run(ctx context.Context, run func(ctx context.Context))

func (*Elector) RunLeaderMetricLoop

func (elector *Elector) RunLeaderMetricLoop(ctx context.Context)

Jump to

Keyboard shortcuts

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