leaderelection

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockConfig

type LockConfig struct {
	// LeaseDuration is the duration that non-leader candidates will
	// wait to force acquire leadership. This is measured against time of
	// last observed ack.
	LeaseDuration time.Duration
	// RenewDeadline is the duration that the acting master will retry
	// refreshing leadership before giving up.
	RenewDeadline time.Duration
	// RetryPeriod is the duration the LeaderElector clients should wait
	// between tries of actions.
	RetryPeriod time.Duration
}

LockConfig is the configuration for the lock (timing, leases...).

type Runner

type Runner interface {
	// Run will run if the instance takes the lead. It's a blocking action.
	Run(func() error) error
}

Runner knows how to run using the leader election.

func New

func New(key, namespace string, lockCfg *LockConfig, k8scli kubernetes.Interface, logger log.Logger) (Runner, error)

New returns a new leader election service.

func NewDefault

func NewDefault(key, namespace string, k8scli kubernetes.Interface, logger log.Logger) (Runner, error)

NewDefault returns a new leader election service with a safe lock configuration.

Jump to

Keyboard shortcuts

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