leaderelection

package
v0.0.0-...-f384223 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigMapNameEnv = "CONFIG_LEADERELECTION_NAME"

Variables

This section is empty.

Functions

func ConfigMapName

func ConfigMapName() string

ConfigMapName returns the name of the configmap to read for leader election settings.

func UniqueID

func UniqueID() (string, error)

UniqueID returns a unique ID for use with a leader elector that prevents from pods running on the same host from colliding with one another.

Types

type ComponentConfig

type ComponentConfig struct {
	LeaderElect   bool
	ResourceLock  string
	LeaseDuration time.Duration
	RenewDeadline time.Duration
	RetryPeriod   time.Duration
}

ComponentConfig represents the leader election config for a single component.

type Config

type Config struct {
	ResourceLock      string
	LeaseDuration     time.Duration
	RenewDeadline     time.Duration
	RetryPeriod       time.Duration
	EnabledComponents sets.String
}

Config represents the leader election config for a set of components contained within a single namespace. Typically these will correspond to a single source repository, viz: serving or eventing.

func NewConfigFromConfigMap

func NewConfigFromConfigMap(configMap *corev1.ConfigMap) (*Config, error)

NewConfigFromConfigMap returns a new Config from the given ConfigMap.

func NewConfigFromMap

func NewConfigFromMap(data map[string]string) (*Config, error)

NewConfigFromMap returns a Config for the given map, or an error.

func (*Config) GetComponentConfig

func (c *Config) GetComponentConfig(name string) ComponentConfig

Jump to

Keyboard shortcuts

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