Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GenerateLeaseIdentity ¶
GenerateLeaseIdentity generates a unique lease identity that can be used in a leader election.
func ObserveLeaderElected ¶
Types ¶
type Config ¶
type Config struct { LeaseName string LeaseNamespace string LeaseDuration time.Duration RenewDeadline time.Duration RetryPeriod time.Duration }
func (*Config) PrepareValues ¶
type Coordinator ¶
type Coordinator interface { IsLeader() bool GetLeader() string Wait(ctx context.Context) error GiveUp() GetLeaseName() string GetLeaseID() string }
func NewCoordinator ¶
func NewCoordinator(client coordinationv1.LeasesGetter, config *Config) (Coordinator, error)
NewCoordinator creates a new Coordinator with a randomly generated identity.
func NewCoordinatorWithIdentity ¶
func NewCoordinatorWithIdentity(client coordinationv1.LeasesGetter, id string, config *Config) (Coordinator, error)
NewCoordinatorWithIdentity creates a new Coordinator with the given identity.
Click to show internal directories.
Click to hide internal directories.