cronjob

package
v0.0.0-...-a5c132e Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, cj *batchv1.CronJob, equal EqualityFunc, mutate MutateFunc) error

CreateOrUpdate attempts first to get the given cronjob. If the cronjob does not exist, the cronjob will be created. Otherwise, if the cronjob exists and the provided comparison func detects any changes an update is attempted. Updates are retried with backoff (See retry.DefaultRetry). Returns on failure an non-nil error.

func Delete

func Delete(ctx context.Context, c client.Client, key client.ObjectKey) error

Delete attempts to delete a k8s deployment if existing or returns an error.

func Equal

func Equal(current, desired *batchv1.CronJob) bool

Equal return only true if the cronjob are equal

func List

func List(ctx context.Context, c client.Client, namespace string, selector map[string]string) ([]batchv1.CronJob, error)

List returns a list of deployments that match the given selector.

func Mutate

func Mutate(current, desired *batchv1.CronJob)

Mutate is a default mutation function for cronjobs that copies only mutable fields from desired to current.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder represents the type to build Cronjob objects

func New

func New(name, namespace string, labels map[string]string) *Builder

New returns a new Builder for Cronjob objects

func (*Builder) Build

func (b *Builder) Build() *batchv1.CronJob

Build returns the final Cronjob object

func (*Builder) WithBackoffLimit

func (b *Builder) WithBackoffLimit(l int32) *Builder

WithBackoffLimit sets the cronjob's job backoff limit

func (*Builder) WithConcurrencyPolicy

func (b *Builder) WithConcurrencyPolicy(cp batchv1.ConcurrencyPolicy) *Builder

WithConcurrencyPolicy sets the concurrency policy for the cronjob

func (*Builder) WithFailedJobsHistoryLimit

func (b *Builder) WithFailedJobsHistoryLimit(l int32) *Builder

WithFailedJobsHistoryLimit sets the limit for the history of failed jobs

func (*Builder) WithParallelism

func (b *Builder) WithParallelism(p int32) *Builder

WithParallelism sets the cronjob's job parallelism limit

func (*Builder) WithPodSpec

func (b *Builder) WithPodSpec(containerName string, spec *corev1.PodSpec) *Builder

WithPodSpec sets the cronjob pod spec and its name

func (*Builder) WithSchedule

func (b *Builder) WithSchedule(s string) *Builder

WithSchedule sets the cronjob's schedule

func (*Builder) WithSuccessfulJobsHistoryLimit

func (b *Builder) WithSuccessfulJobsHistoryLimit(l int32) *Builder

WithSuccessfulJobsHistoryLimit sets the limit for the history of successful jobs

func (*Builder) WithSuspend

func (b *Builder) WithSuspend(s bool) *Builder

WithSuspend sets the cronjob's suspend state

type EqualityFunc

type EqualityFunc func(current, desired *batchv1.CronJob) bool

EqualityFunc is the type for functions that compare two cronjobs. Return true if two cronjobs are equal.

type MutateFunc

type MutateFunc func(current, desired *batchv1.CronJob)

MutateFunc is the type for functions that mutate the current cronjob by applying the values from the desired cronjob.

Jump to

Keyboard shortcuts

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