statefuljob

package
v0.0.0-...-6b34a6b Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJobStatus

func AddJobStatus(existing []batchv1.JobStatus, status batchv1.JobStatus) []batchv1.JobStatus

AddJobStatus adds the status to the head of the list.

func BuildJobs

func BuildJobs(crd *cosmosalpha.StatefulJob) []*batchv1.Job

BuildJobs returns jobs to compress and upload data to an object storage.

func BuildPVCs

BuildPVCs builds PVCs given the crd and VolumeSnapshot.

func DeletePredicate

func DeletePredicate() predicate.Predicate

DeletePredicate watches all delete events.

func FindActiveJob

func FindActiveJob(ctx context.Context, getter Getter, crd *cosmosalpha.StatefulJob) (bool, *batchv1.Job, error)

FindActiveJob finds the currently active job in any state. A job is considered inactive if it cannot be found.

func LabelSelectorPredicate

func LabelSelectorPredicate() predicate.Predicate

LabelSelectorPredicate returns a predicate matching default labels created by the operator.

func ReadyForSnapshot

func ReadyForSnapshot(crd *cosmosalpha.StatefulJob, now time.Time) bool

ReadyForSnapshot returns true if enough time has passed to create a new snapshot.

func ResourceName

func ResourceName(crd *cosmosalpha.StatefulJob) string

ResourceName is the name of all resources created by the controller.

func UpdateJobStatus

func UpdateJobStatus(existing []batchv1.JobStatus, status batchv1.JobStatus) []batchv1.JobStatus

UpdateJobStatus updates the most recent status (at the head). If the list is empty, this operation is a no-op.

Types

type CreateClient

type CreateClient interface {
	Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
	Scheme() *runtime.Scheme
}

CreateClient creates and sets owner reference.

type Creator

type Creator[T client.Object] struct {
	// contains filtered or unexported fields
}

Creator creates objects and assigns the owner reference.

func NewCreator

func NewCreator[T client.Object](client CreateClient, builder func() ([]T, error)) Creator[T]

NewCreator returns a valid Creator.

func (Creator[T]) Create

func (c Creator[T]) Create(ctx context.Context, crd *cosmosalpha.StatefulJob) error

Create builds the resources, creates them, and assigns owner reference.

type Getter

type Getter interface {
	Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
}

Jump to

Keyboard shortcuts

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