leaderelection

package
v0.10.3 Latest Latest
Warning

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

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

Documentation

Overview

Package leaderelection implements the leader election mechanism. It avoids that multiple virtual node targeting the same cluster reflect some resources.

Index

Constants

View Source
const LeaderElectorName = "virtual-kubelet-leader-election"

LeaderElectorName is the name of the leader election lock.

Variables

This section is empty.

Functions

func InitAndRun

func InitAndRun(ctx context.Context, opts Opts, rc *rest.Config,
	eb record.EventBroadcaster, initCallback func()) error

InitAndRun initializes and runs the leader election mechanism.

func IsLeader

func IsLeader() bool

IsLeader returns true if the current virtual node is the leader.

Types

type Opts

type Opts struct {
	Enabled         bool
	PodName         string
	TenantNamespace string
	LeaseDuration   time.Duration
	RenewDeadline   time.Duration
	RetryPeriod     time.Duration
}

Opts contains the options to configure the leader election mechanism.

Jump to

Keyboard shortcuts

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