package leaderelection
import "sigs.k8s.io/controller-runtime/pkg/leaderelection"
Package leaderelection contains a constructor for a leader election resource lock. This is used to ensure that multiple copies of a controller manager can be run with only one active set of controllers, for active-passive HA.
It uses built-in Kubernetes leader election APIs.
Index ¶
- func NewResourceLock(config *rest.Config, recorderProvider recorder.Provider, options Options) (resourcelock.Interface, error)
- type Options
Functions ¶
func NewResourceLock ¶
func NewResourceLock(config *rest.Config, recorderProvider recorder.Provider, options Options) (resourcelock.Interface, error)
NewResourceLock creates a new resource lock for use in a leader election loop.
Types ¶
type Options ¶
type Options struct { // LeaderElection determines whether or not to use leader election when // starting the manager. LeaderElection bool // LeaderElectionResourceLock determines which resource lock to use for leader election, // defaults to "leases". LeaderElectionResourceLock string // LeaderElectionNamespace determines the namespace in which the leader // election resource will be created. LeaderElectionNamespace string // LeaderElectionID determines the name of the resource that leader election // will use for holding the leader lock. LeaderElectionID string // RenewDeadline is the renew deadline for this leader election client. // Must be set to ensure the resource lock has an appropriate client timeout. // Without that, a single slow response from the API server can result // in losing leadership. RenewDeadline time.Duration }
Options provides the required configuration to create a new resource lock.
Source Files ¶
doc.go leader_election.go
Directories ¶
Path | Synopsis |
---|---|
pkg/leaderelection/fake | Package fake mocks a resource lock for testing purposes. |
- Version
- v0.20.4 (latest)
- Published
- Mar 24, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 2 days ago –
Tools for package owners.