election

package
v0.0.0-...-1bdd90c Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewElection

func NewElection(config Config, client kubernetes.Interface) (*leaderelection.LeaderElector, error)

NewElection returns leaderelection.LeaderElector to start election, should use leaderelection.LeaderElector.Run(ctx)

Types

type Config

type Config struct {
	// ElectionID unique id
	ElectionID string
	// ResourceName k8s resource type, default is configmap
	ResourceName string
	// ResourceNamespace set namespace for election config file
	ResourceNamespace string
	// Callbacks monitor the master-slave election events
	Callbacks leaderelection.LeaderCallbacks
}

Config used to configure leader election

type Elector

type Elector interface {
	// IsLeader return true if instance is leader
	IsLeader() bool
	// Run start leader election
	Run(context.Context)
}

Elector interface

Jump to

Keyboard shortcuts

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