Documentation ¶
Index ¶
- type Elector
- type Option
- func WithHealthChecker(healthChecker *leaderelection.HealthzAdaptor) Option
- func WithLockType(lockType string) Option
- func WithNamespace(namespace string) Option
- func WithOnNewLeader(onNewLeader func(string)) Option
- func WithOnStartedLeading(onStartedLeading func(context.Context)) Option
- func WithOnStoppedLeading(onStartedLeading func()) Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elector ¶
type Elector interface { IsLeader() bool GetLeader() string MyIdentity() string Run(ctx context.Context) }
func NewElector ¶
func NewElector(kubeClient kubernetes.Interface, name string, opt ...Option) Elector
type Option ¶
type Option func(*Options)
func WithHealthChecker ¶
func WithHealthChecker(healthChecker *leaderelection.HealthzAdaptor) Option
func WithLockType ¶
func WithNamespace ¶
func WithOnNewLeader ¶
func WithOnStartedLeading ¶
func WithOnStoppedLeading ¶
func WithOnStoppedLeading(onStartedLeading func()) Option
type Options ¶
type Options struct { Identity string LockType string KubeClient kubernetes.Interface EventRecorder record.EventRecorder Namespace string Name string LeaseDuration time.Duration RenewDuration time.Duration RetryPeriod time.Duration HealthChecker *leaderelection.HealthzAdaptor // OnStartedLeading is called when a LeaderElector client starts leading OnStartedLeading func(context.Context) // OnStoppedLeading is called when a LeaderElector client stops leading OnStoppedLeading func() // OnNewLeader is called when the client observes a leader that is // not the previously observed leader. This includes the first observed // leader when the client starts. OnNewLeader func(identity string) }
Click to show internal directories.
Click to hide internal directories.