dynamic-resource-allocationk8s.io/dynamic-resource-allocation/leaderelection Index | Files

package leaderelection

import "k8s.io/dynamic-resource-allocation/leaderelection"

Package leaderelection wraps k8s.io/client-go/tools/leaderelection with a simpler API. It's derived from https://github.com/kubernetes-csi/csi-lib-utils/tree/v0.11.0/leaderelection

Index

Constants

const (

	// HealthCheckerAddress is the address at which the leader election health
	// checker reports status.
	// The caller sidecar should document this address in appropriate flag
	// descriptions.
	HealthCheckerAddress = "/healthz/leader-election"
)

Functions

func New

func New(clientset kubernetes.Interface, lockName string, runFunc func(ctx context.Context), opts ...Option) *leaderElection

New constructs a new leader election instance.

Types

type Option

type Option func(l *leaderElection)

Option implements functional options for New.

func Context

func Context(ctx context.Context) Option

func HealthCheckTimeout

func HealthCheckTimeout(timeout time.Duration) Option

func Identity

func Identity(identity string) Option

func LeaseDuration

func LeaseDuration(leaseDuration time.Duration) Option

func Namespace

func Namespace(namespace string) Option

func RenewDeadline

func RenewDeadline(renewDeadline time.Duration) Option

func RetryPeriod

func RetryPeriod(retryPeriod time.Duration) Option

type Server

type Server interface {
	Handle(pattern string, handler http.Handler)
}

Server represents any type that could serve HTTP requests for the leader election health check endpoint.

Source Files

leaderelection.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
1 month ago

Tools for package owners.