Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockConfig ¶
type LockConfig struct { // LeaseDuration is the duration that non-leader candidates will // wait to force acquire leadership. This is measured against time of // last observed ack. LeaseDuration time.Duration // RenewDeadline is the duration that the acting master will retry // refreshing leadership before giving up. RenewDeadline time.Duration // RetryPeriod is the duration the LeaderElector clients should wait // between tries of actions. RetryPeriod time.Duration }
LockConfig is the configuration for the lock (timing, leases...).
type Runner ¶
type Runner interface { // Run will run if the instance takes the lead. It's a blocking action. Run(func() error) error }
Runner knows how to run using the leader election.
func New ¶
func New(key, namespace string, lockCfg *LockConfig, k8scli kubernetes.Interface, logger log.Logger) (Runner, error)
New returns a new leader election service.
func NewDefault ¶
func NewDefault(key, namespace string, k8scli kubernetes.Interface, logger log.Logger) (Runner, error)
NewDefault returns a new leader election service with a safe lock configuration.
Click to show internal directories.
Click to hide internal directories.