kubernetesk8s.io/kubernetes/pkg/controlplane/controller/leaderelection Index | Files

package leaderelection

import "k8s.io/kubernetes/pkg/controlplane/controller/leaderelection"

Index

Variables

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 NewController

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 coordinationv1beta1informers.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)

Source Files

election.go leaderelection_controller.go leasecandidategc_controller.go run_with_leaderelection.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
30 packages
Last checked
3 hours ago

Tools for package owners.