handler

package
v1.99.99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScheduleHourlyRandom   = "@hourly-random"
	ScheduleDailyRandom    = "@daily-random"
	ScheduleYearlyRandom   = "@yearly-random"
	ScheduleAnnuallyRandom = "@annually-random"
	ScheduleMonthlyRandom  = "@monthly-random"
	ScheduleWeeklyRandom   = "@weekly-random"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	job.Config
}

Handler is the generic job handler for most of the k8up jobs.

func NewHandler

func NewHandler(config job.Config) *Handler

NewHandler will return a new generic handler.

func (*Handler) Handle

func (h *Handler) Handle() error

Handle will add it to the queue.

type JobHandler

type JobHandler struct {
	job.Config
	// contains filtered or unexported fields
}

JobHandler handles the reconciles for the batchv1.job objects that are observed by the operator.

func NewJobHandler

func NewJobHandler(config job.Config, job *batchv1.Job) *JobHandler

NewJobHandler returns a new JobHandler.

func (*JobHandler) Handle

func (j *JobHandler) Handle() error

Handle extracts some information from the batchv1.job that make observations easier.

type ScheduleHandler

type ScheduleHandler struct {
	job.Config
	// contains filtered or unexported fields
}

ScheduleHandler handles the reconciles for the schedules. Schedules are a special type of k8up objects as they will only trigger jobs indirectly.

func NewScheduleHandler

func NewScheduleHandler(
	config job.Config, schedule *k8upv1alpha1.Schedule,
	effectiveSchedules map[k8upv1alpha1.JobType]k8upv1alpha1.EffectiveSchedule) *ScheduleHandler

NewScheduleHandler will return a new ScheduleHandler.

func (*ScheduleHandler) DeleteResource

func (s *ScheduleHandler) DeleteResource(obj client.Object) error

DeleteResource will delete the given resource. Errors will be logged, and the Ready condition set to False.

func (*ScheduleHandler) Handle

func (s *ScheduleHandler) Handle() error

Handle handles the schedule management. It's responsible for adding and removing the jobs from the internal cron library.

func (*ScheduleHandler) UpsertResource

func (s *ScheduleHandler) UpsertResource(obj client.Object) error

UpsertResource updates the given object if it exists. If it fails with not existing error, it will be created. If both operation failed, the error is logged and Ready condition will be set to False.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL