Documentation
¶
Index ¶
Constants ¶
const ( // LeaseDuration is the duration that non-leader candidates will // wait to force acquire leadership. This is measured against time of // last observed ack. // LeaseDuration = 5 * time.Second // RenewDeadline is the duration that the acting manager will retry // refreshing leadership before giving up. // RenewDeadline = 3 * time.Second // RetryPeriod is the duration the LeaderElector clients should wait // between tries of actions. // RetryPeriod = 2 * time.Second // FirstLeaderDeadline is the duration to wait for the leader to acquire the lease for the first time. // Known issue: the lease is not released when we delete an agent deployment, // it's causing the new agents to think that the old agent still hold the lease, // therefore, we wait for at least a LeaseDuration + few seconds. FirstLeaderDeadline = LeaseDuration + 5*time.Second PodNameEnvar = "POD_NAME" LeaderLeaseName = "cloudbeat-cluster-leader" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultUniqueManager ¶
type DefaultUniqueManager struct{}
DefaultUniqueManager A dummy leader-election manager to implement the UniquenessManager interface. Use to keep the leaderelection code clean and without a non k8s logic.
func (*DefaultUniqueManager) IsLeader ¶
func (d *DefaultUniqueManager) IsLeader() bool
func (*DefaultUniqueManager) Stop ¶
func (d *DefaultUniqueManager) Stop()
type LeaderelectionManager ¶
type LeaderelectionManager struct {
// contains filtered or unexported fields
}
func (*LeaderelectionManager) IsLeader ¶
func (m *LeaderelectionManager) IsLeader() bool
func (*LeaderelectionManager) Run ¶
func (m *LeaderelectionManager) Run(ctx context.Context) error
Run leader election is blocking until a FirstLeaderDeadline timeout has reached.
func (*LeaderelectionManager) Stop ¶
func (m *LeaderelectionManager) Stop()
type MockManager ¶
MockManager is an autogenerated mock type for the Manager type
func NewMockManager ¶
func NewMockManager(t interface { mock.TestingT Cleanup(func()) }) *MockManager
NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockManager) EXPECT ¶
func (_m *MockManager) EXPECT() *MockManager_Expecter
func (*MockManager) IsLeader ¶
func (_m *MockManager) IsLeader() bool
IsLeader provides a mock function with given fields:
func (*MockManager) Run ¶
func (_m *MockManager) Run(ctx context.Context) error
Run provides a mock function with given fields: ctx
func (*MockManager) Stop ¶
func (_m *MockManager) Stop()
Stop provides a mock function with given fields:
type MockManager_Expecter ¶
type MockManager_Expecter struct {
// contains filtered or unexported fields
}
func (*MockManager_Expecter) IsLeader ¶
func (_e *MockManager_Expecter) IsLeader() *MockManager_IsLeader_Call
IsLeader is a helper method to define mock.On call
func (*MockManager_Expecter) Run ¶
func (_e *MockManager_Expecter) Run(ctx interface{}) *MockManager_Run_Call
Run is a helper method to define mock.On call
- ctx context.Context
func (*MockManager_Expecter) Stop ¶
func (_e *MockManager_Expecter) Stop() *MockManager_Stop_Call
Stop is a helper method to define mock.On call
type MockManager_IsLeader_Call ¶
MockManager_IsLeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsLeader'
func (*MockManager_IsLeader_Call) Return ¶
func (_c *MockManager_IsLeader_Call) Return(_a0 bool) *MockManager_IsLeader_Call
func (*MockManager_IsLeader_Call) Run ¶
func (_c *MockManager_IsLeader_Call) Run(run func()) *MockManager_IsLeader_Call
func (*MockManager_IsLeader_Call) RunAndReturn ¶
func (_c *MockManager_IsLeader_Call) RunAndReturn(run func() bool) *MockManager_IsLeader_Call
type MockManager_Run_Call ¶
MockManager_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run'
func (*MockManager_Run_Call) Return ¶
func (_c *MockManager_Run_Call) Return(_a0 error) *MockManager_Run_Call
func (*MockManager_Run_Call) Run ¶
func (_c *MockManager_Run_Call) Run(run func(ctx context.Context)) *MockManager_Run_Call
func (*MockManager_Run_Call) RunAndReturn ¶
func (_c *MockManager_Run_Call) RunAndReturn(run func(context.Context) error) *MockManager_Run_Call
type MockManager_Stop_Call ¶
MockManager_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
func (*MockManager_Stop_Call) Return ¶
func (_c *MockManager_Stop_Call) Return() *MockManager_Stop_Call
func (*MockManager_Stop_Call) Run ¶
func (_c *MockManager_Stop_Call) Run(run func()) *MockManager_Stop_Call
func (*MockManager_Stop_Call) RunAndReturn ¶
func (_c *MockManager_Stop_Call) RunAndReturn(run func()) *MockManager_Stop_Call