leaderelection

package
v0.30.0 Latest Latest
Warning

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

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

Documentation

Overview

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

View Source
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"
)

Variables

This section is empty.

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.

Jump to

Keyboard shortcuts

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