Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lease ¶
type Lease struct {
// contains filtered or unexported fields
}
Lease implements a lease on time ranges for different backends. If the lease backend has intermittent failure, the lease will attempt to gracefully fail open by extending the lease of the most recent lease holder. This is done in best-effort manner.
func New ¶
func New( logger log.Logger, metrics prometheus.Registerer, lock resourcelock.Interface, opts *Options, ) (*Lease, error)
func NewKubernetes ¶
func NewKubernetes( logger log.Logger, metrics prometheus.Registerer, config *rest.Config, namespace, name string, opts *Options, ) (*Lease, error)
func (*Lease) OnLeaderChange ¶
func (l *Lease) OnLeaderChange(f func())
OnLeaderChange sets a callback that's invoked when the leader of the lease changes.
type Options ¶
type Options struct { // LeaseDuration is the duration that non-leader candidates will // wait to force acquire leadership. This is measured against time of // last observed ack. // // A client needs to wait a full LeaseDuration without observing a change to // the record before it can attempt to take over. When all clients are // shutdown and a new set of clients are started with different names against // the same leader record, they must wait the full LeaseDuration before // attempting to acquire the lease. Thus LeaseDuration should be as short as // possible (within your tolerance for clock skew rate) to avoid a possible // long waits in the scenario. // // Defaults to 15 seconds. LeaseDuration time.Duration // RenewDeadline is the duration that the acting master will retry // refreshing leadership before giving up. // // Defaults to 10 seconds. RenewDeadline time.Duration // RetryPeriod is the duration the LeaderElector clients should wait // between tries of actions. // // Defaults to 2 seconds. RetryPeriod time.Duration }
Click to show internal directories.
Click to hide internal directories.