leaderelection

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TODO: Eventually these should be configurable
	LeaseDuration = 15 * time.Second
	RenewDeadline = 10 * time.Second
	RetryPeriod   = 2 * time.Second
)

Functions

func RunWithLeaderElection

func RunWithLeaderElection(ctx context.Context, config *rest.Config, newRunnerFn NewRunner)

RunWithLeaderElection runs the provided runner function with leader election. newRunnerFn might be called multiple times, and it should return another controller instance's Run method each time. RunWithLeaderElection only returns when the context is done, or initial leader election fails.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the leader election controller, which observes component identity leases for components that have self-nominated as candidate leaders for leases and elects leaders for those leases, favoring candidates with higher versions.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, workers int)

type LeaseCandidateGCController

type LeaseCandidateGCController struct {
	// contains filtered or unexported fields
}

func NewLeaseCandidateGC

func NewLeaseCandidateGC(clientset kubernetes.Interface, gcCheckPeriod time.Duration, leaseCandidateInformer coordinationv1alpha2informers.LeaseCandidateInformer) *LeaseCandidateGCController

NewLeaseCandidateGC creates a new LeaseCandidateGCController.

func (*LeaseCandidateGCController) Run

Run starts one worker.

type NewRunner

type NewRunner func() (func(ctx context.Context, workers int), error)

Jump to

Keyboard shortcuts

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