v1alpha1

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the v1alpha1 API group. +kubebuilder:object:generate=true +groupName=apps.kubedl.io

Index

Constants

View Source
const (
	KindCron = "Cron"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: "apps.kubedl.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type ConcurrencyPolicy

type ConcurrencyPolicy string

ConcurrencyPolicy describes how concurrent executions of a job will be handled. Only one of the following concurrent policies may be specified. If none of the following policies is specified, the default one is Allow. +kubebuilder:validation:Enum=Allow;Forbid;Replace

const (
	// ConcurrentPolicyAllow allows cron jobs to run concurrently.
	// Multiple instances of the job can run at the same time.
	ConcurrentPolicyAllow ConcurrencyPolicy = "Allow"

	// ConcurrentPolicyForbid forbids concurrent runs.
	// If the previous run hasn't finished yet, the next scheduled run will be skipped.
	ConcurrentPolicyForbid ConcurrencyPolicy = "Forbid"

	// ConcurrentPolicyReplace cancels the currently running job and replaces it with a new one.
	// This ensures only one job instance runs at a time by terminating the old one.
	ConcurrentPolicyReplace ConcurrencyPolicy = "Replace"
)

type Cron

type Cron struct {
	metav1.TypeMeta `json:",inline"`

	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	metav1.ObjectMeta `json:"metadata,omitzero"`

	// Spec defines the desired state of Cron.
	// +required
	Spec CronSpec `json:"spec"`

	// Status defines the observed state of Cron.
	// +optional
	Status CronStatus `json:"status,omitzero"`
}

Cron is the Schema for the crons API. It represents a scheduled job that runs workloads at specified times using cron expressions.

func (*Cron) DeepCopy

func (in *Cron) DeepCopy() *Cron

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cron.

func (*Cron) DeepCopyInto

func (in *Cron) DeepCopyInto(out *Cron)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Cron) DeepCopyObject

func (in *Cron) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CronHistory

type CronHistory struct {
	// UID is the unique identifier of the scheduled job.
	// +optional
	UID types.UID `json:"uid,omitempty"`

	// Object is the reference to the historical scheduled cron job.
	// It contains the kind, name, and API group of the workload.
	// +required
	Object corev1.TypedLocalObjectReference `json:"object"`

	// Status is the final status of the job when it finished execution.
	// +required
	Status kubeflowv1.JobConditionType `json:"status"`

	// Created is the timestamp when the job was created.
	// +optional
	Created *metav1.Time `json:"created,omitempty"`

	// Finished is the timestamp when the job finished execution (either succeeded or failed).
	// +optional
	Finished *metav1.Time `json:"finished,omitempty"`
}

CronHistory represents a historical record of a scheduled cron job execution.

func (*CronHistory) DeepCopy

func (in *CronHistory) DeepCopy() *CronHistory

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronHistory.

func (*CronHistory) DeepCopyInto

func (in *CronHistory) DeepCopyInto(out *CronHistory)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CronList

type CronList struct {
	metav1.TypeMeta `json:",inline"`

	// Standard list metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#lists-and-simple-kinds
	metav1.ListMeta `json:"metadata,omitzero"`

	// Items is the list of Cron objects.
	Items []Cron `json:"items"`
}

CronList contains a list of Cron resources.

func (*CronList) DeepCopy

func (in *CronList) DeepCopy() *CronList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronList.

func (*CronList) DeepCopyInto

func (in *CronList) DeepCopyInto(out *CronList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CronList) DeepCopyObject

func (in *CronList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CronSpec

type CronSpec struct {
	// Schedule specifies the cron schedule in standard cron format.
	// For example: "0 0 * * *" for daily at midnight, "*/5 * * * *" for every 5 minutes.
	// See https://en.wikipedia.org/wiki/Cron for more details.
	// +required
	Schedule string `json:"schedule"`

	// Template specifies the workload template that will be created when executing a cron job.
	// +required
	Template CronTemplateSpec `json:"template"`

	// ConcurrencyPolicy specifies how to treat concurrent executions of a job.
	// Valid values are:
	// - "Allow" (default): allows cron jobs to run concurrently.
	// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet.
	// - "Replace": cancels currently running job and replaces it with a new one.
	// +optional
	// +kubebuilder:default=Allow
	ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`

	// Suspend tells the controller to suspend subsequent executions.
	// It does not apply to already started executions.
	// Defaults to false.
	// +optional
	Suspend *bool `json:"suspend,omitempty"`

	// Deadline is the optional deadline timestamp after which the cron job will stop scheduling new executions.
	// If specified, no new jobs will be created after this time.
	// +optional
	Deadline *metav1.Time `json:"deadline,omitempty"`

	// HistoryLimit specifies the number of finished job history records to retain.
	// This is a pointer to distinguish between explicit zero and not specified.
	// If not set, a default value will be used by the controller.
	// +optional
	HistoryLimit *int `json:"historyLimit,omitempty"`
}

CronSpec defines the desired state of Cron.

func (*CronSpec) DeepCopy

func (in *CronSpec) DeepCopy() *CronSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronSpec.

func (*CronSpec) DeepCopyInto

func (in *CronSpec) DeepCopyInto(out *CronSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CronStatus

type CronStatus struct {
	// Active contains a list of references to currently running jobs created by this cron.
	// +optional
	// +listType=atomic
	Active []corev1.ObjectReference `json:"active,omitempty"`

	// History is a list of previously scheduled cron jobs with their execution records.
	// This provides an audit trail of job executions.
	// +optional
	// +listType=atomic
	History []CronHistory `json:"history,omitempty"`

	// LastScheduleTime records the last time a job was successfully scheduled.
	// This is used to determine the next execution time.
	// +optional
	LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
}

CronStatus defines the observed state of Cron.

func (*CronStatus) DeepCopy

func (in *CronStatus) DeepCopy() *CronStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronStatus.

func (*CronStatus) DeepCopyInto

func (in *CronStatus) DeepCopyInto(out *CronStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CronTemplateSpec

type CronTemplateSpec struct {
	metav1.TypeMeta `json:",inline"`

	// Workload contains the specification of the desired workload to be scheduled.
	// It can be any Kubernetes workload type (e.g., Job, Deployment, Pod).
	// The workload is stored as RawExtension to support different resource types.
	// +kubebuilder:pruning:PreserveUnknownFields
	Workload *runtime.RawExtension `json:"workload,omitempty"`
}

CronTemplateSpec describes a template for launching a specific workload.

func (*CronTemplateSpec) DeepCopy

func (in *CronTemplateSpec) DeepCopy() *CronTemplateSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronTemplateSpec.

func (*CronTemplateSpec) DeepCopyInto

func (in *CronTemplateSpec) DeepCopyInto(out *CronTemplateSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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