Documentation
¶
Overview ¶
Package runnables provides helper types for creating runnables for the controller-runtime manager when leader election is enabled.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallFunctionsAfterBecameLeader ¶
type CallFunctionsAfterBecameLeader struct {
// contains filtered or unexported fields
}
CallFunctionsAfterBecameLeader is a Runnable that will call the given functions when the current instance becomes the leader.
func NewCallFunctionsAfterBecameLeader ¶
func NewCallFunctionsAfterBecameLeader( enableFunctions []func(context.Context), ) *CallFunctionsAfterBecameLeader
NewCallFunctionsAfterBecameLeader creates a new CallFunctionsAfterBecameLeader Runnable.
func (*CallFunctionsAfterBecameLeader) NeedLeaderElection ¶
func (j *CallFunctionsAfterBecameLeader) NeedLeaderElection() bool
type CronJob ¶
type CronJob struct {
// contains filtered or unexported fields
}
CronJob periodically runs a worker function.
type CronJobConfig ¶
type CronJobConfig struct { // Worker is the function that will be run for every cronjob iteration. Worker func(context.Context) // ReadyCh delays the start of the job until the channel is closed. ReadyCh <-chan struct{} // Logger is the logger. Logger logr.Logger // Period defines the period of the cronjob. The cronjob will run every Period. Period time.Duration // JitterFactor sets the jitter for the cronjob. If positive, the period is jittered before every // run of the worker. If jitterFactor is not positive, the period is unchanged and not jittered. JitterFactor float64 }
CronJobConfig is the configuration for a cronjob.
type Leader ¶
Leader is a Runnable that needs to be run only when the current instance is the leader.
func (*Leader) NeedLeaderElection ¶
type LeaderOrNonLeader ¶
LeaderOrNonLeader is a Runnable that needs to be run regardless of whether the current instance is the leader.
func (*LeaderOrNonLeader) NeedLeaderElection ¶
func (r *LeaderOrNonLeader) NeedLeaderElection() bool