Documentation ¶
Index ¶
- Variables
- func ClockTickUntil(work func(), timestep time.Duration, stopCh <-chan struct{})
- func IsScheduleEqual(orig, updated *execution.ScheduleSpec) (bool, error)
- func JobConfigKeyFunc(config *execution.JobConfig, scheduleTime time.Time) (string, error)
- func JoinJobConfigKeyName(key string, ts time.Time) string
- func ParseUnix(unixString string) (time.Time, error)
- func SplitJobConfigKeyName(key string) (name string, ts time.Time, err error)
- type Context
- type Controller
- type CronWorker
- type EnqueueHandler
- type ExecutionControl
- type ExecutionControlInterface
- type Factory
- type InformerWorker
- type Reconciler
- type Recorder
- type UpdateHandler
Constants ¶
This section is empty.
Variables ¶
var (
Clock clock.Clock = &clock.RealClock{}
)
Functions ¶
func ClockTickUntil ¶ added in v0.1.0
ClockTickUntil runs work every timestep until stopCh is signaled. The work function will first be called immediately on initial call, followed by rounding up to the nearest timestep for every subsequent step. The smallest timestep that is admissible is a second.
func IsScheduleEqual ¶
func IsScheduleEqual(orig, updated *execution.ScheduleSpec) (bool, error)
IsScheduleEqual returns true if the ScheduleSpec is not equal and should be updated. This equality check is only true in the context of the CronController.
func JobConfigKeyFunc ¶
JobConfigKeyFunc returns a key to return the key for a JobConfig with the scheduled timestamp.
func JoinJobConfigKeyName ¶ added in v0.1.0
JoinJobConfigKeyName joins a key with a scheduled timestamp for a JobConfig. Performs the reverse of SplitJobConfigKeyName.
Types ¶
type Context ¶
type Context struct { controllercontext.Context HasSynced []cache.InformerSynced // contains filtered or unexported fields }
Context extends the common controllercontext.Context.
func NewContext ¶
func NewContext(context controllercontext.Context) *Context
NewContext returns a new Context.
type Controller ¶
type Controller struct { *Context // contains filtered or unexported fields }
Controller is responsible for creating new Jobs from JobConfigs based on their cron schedule.
func NewController ¶
func NewController( ctrlContext controllercontext.Context, concurrency *configv1alpha1.Concurrency, ) (*Controller, error)
func (*Controller) GetHealth ¶
func (c *Controller) GetHealth() controllermanager.HealthStatus
func (*Controller) Shutdown ¶
func (c *Controller) Shutdown(ctx context.Context)
type CronWorker ¶
type CronWorker struct { *Context // contains filtered or unexported fields }
CronWorker enqueues Job names to be scheduled, based on the cron schedule of the config. It will enqueue one item for each schedule interval, which is a 1:1 correspondence with a Job to be created.
func NewCronWorker ¶
func NewCronWorker(ctrlContext *Context, handler EnqueueHandler) *CronWorker
func (*CronWorker) Init ¶ added in v0.2.1
func (w *CronWorker) Init() error
Init is called before we start the worker. We will initialize all JobConfigs into the Schedule.
func (*CronWorker) Start ¶
func (w *CronWorker) Start(ctx context.Context)
func (*CronWorker) Work ¶ added in v0.1.0
func (w *CronWorker) Work()
Work runs a single iteration of synchronizing all JobConfigs.
func (*CronWorker) WorkerName ¶
func (w *CronWorker) WorkerName() string
type EnqueueHandler ¶ added in v0.1.0
type EnqueueHandler interface {
EnqueueJobConfig(jobConfig *execution.JobConfig, scheduleTime time.Time) error
}
EnqueueHandler knows how to enqueue a JobConfig to be created.
type ExecutionControl ¶ added in v0.1.0
type ExecutionControl struct {
// contains filtered or unexported fields
}
ExecutionControl is a wrapper around the Execution clientset.
func NewExecutionControl ¶ added in v0.1.0
func NewExecutionControl( name string, client executionv1alpha1.ExecutionV1alpha1Interface, recorder Recorder, ) *ExecutionControl
type ExecutionControlInterface ¶ added in v0.1.0
type Factory ¶
type Factory struct{}
func NewFactory ¶
func NewFactory() *Factory
func (*Factory) New ¶
func (f *Factory) New( ctrlContext controllercontext.Context, concurrencySpec *configv1alpha1.ExecutionControllerConcurrencySpec, ) (controllermanager.Controller, error)
type InformerWorker ¶
type InformerWorker struct { *Context // contains filtered or unexported fields }
InformerWorker receives events from the informer and enqueues work to be done for the controller.
func NewInformerWorker ¶
func NewInformerWorker(ctrlContext *Context, handler UpdateHandler) *InformerWorker
func (*InformerWorker) Init ¶ added in v0.1.0
func (w *InformerWorker) Init()
func (*InformerWorker) WorkerName ¶
func (w *InformerWorker) WorkerName() string
type Reconciler ¶
type Reconciler struct { *Context // contains filtered or unexported fields }
Reconciler creates Jobs that are queued to be started from the workqueue, with a schedule time and JobConfig, unless forbidden by the ConcurrencyPolicy. It may be possible for multiple workers to process the same JobConfig concurrently.
func NewReconciler ¶
func NewReconciler( ctrlContext *Context, client ExecutionControlInterface, recorder Recorder, store controllercontext.ActiveJobStore, concurrency *configv1alpha1.Concurrency, ) *Reconciler
func (*Reconciler) Concurrency ¶
func (w *Reconciler) Concurrency() int
func (*Reconciler) MaxRequeues ¶
func (w *Reconciler) MaxRequeues() int
func (*Reconciler) Name ¶
func (w *Reconciler) Name() string
type Recorder ¶ added in v0.1.0
type Recorder interface { // CreatedJob creates an event when a JobConfig created a new Job. CreatedJob(ctx context.Context, jobConfig *execution.JobConfig, job *execution.Job) // CreateJobFailed creates an event when a JobConfig failed to create a new Job. CreateJobFailed(ctx context.Context, jobConfig *execution.JobConfig, job *execution.Job, message string) // SkippedJobSchedule creates an event whenever a JobConfig's schedule was skipped for whatever reason. SkippedJobSchedule(ctx context.Context, jobConfig *execution.JobConfig, scheduleTime time.Time, message string) }
Recorder knows how to record events for the CronController.
type UpdateHandler ¶ added in v0.1.0
UpdateHandler knows how to handle updates for a JobConfig.
func NewUpdateHandler ¶ added in v0.1.0
func NewUpdateHandler(ctrlContext *Context) UpdateHandler