feat: scaffold job execution API
Verify / lint (pull_request) Failing after 5m37s
Verify / test (pull_request) Successful in 5m38s

This commit is contained in:
2026-09-17 18:58:11 +00:00
parent 7a47221280
commit 4846ff2aba
65 changed files with 4555 additions and 0 deletions
@@ -0,0 +1,28 @@
// Package v1alpha1 contains API Schema definitions for the execution v1alpha1 API group.
// +kubebuilder:object:generate=true
// +groupName=execution.ayatori.ddupan.top
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
// SchemeGroupVersion is group version used to register these objects.
// This name is used by applyconfiguration generators (e.g. controller-gen).
SchemeGroupVersion = schema.GroupVersion{Group: "execution.ayatori.ddupan.top", Version: "v1alpha1"}
// GroupVersion is an alias for SchemeGroupVersion, for backward compatibility.
GroupVersion = SchemeGroupVersion
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
SchemeBuilder = runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error {
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
})
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
+180
View File
@@ -0,0 +1,180 @@
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
)
const (
JobConditionAccepted = "Accepted"
JobConditionScheduled = "Scheduled"
JobConditionSucceeded = "Succeeded"
)
type JobDesiredState string
const (
JobDesiredStateRunning JobDesiredState = "Running"
JobDesiredStateCancelled JobDesiredState = "Cancelled"
)
type TaskSpec struct {
// +kubebuilder:validation:MinLength=1
Image string `json:"image"`
// +optional
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
// +optional
Command []string `json:"command,omitempty"`
// +optional
Args []string `json:"args,omitempty"`
// +optional
WorkingDir string `json:"workingDir,omitempty"`
// +listType=map
// +listMapKey=name
// +optional
Env []EnvVar `json:"env,omitempty"`
}
// +kubebuilder:validation:XValidation:rule="has(self.value) != has(self.valueFrom)",message="exactly one of value or valueFrom must be set"
type EnvVar struct {
// +kubebuilder:validation:Pattern=`^[A-Za-z_][A-Za-z0-9_]*$`
Name string `json:"name"`
// +optional
Value *string `json:"value,omitempty"`
// +optional
ValueFrom *EnvVarSource `json:"valueFrom,omitempty"`
}
// +kubebuilder:validation:XValidation:rule="has(self.secretKeyRef) != has(self.configMapKeyRef)",message="exactly one key reference must be set"
type EnvVarSource struct {
// +optional
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
// +optional
ConfigMapKeyRef *corev1.ConfigMapKeySelector `json:"configMapKeyRef,omitempty"`
}
type ResourceValues struct {
// +optional
CPU *resource.Quantity `json:"cpu,omitempty"`
// +optional
Memory *resource.Quantity `json:"memory,omitempty"`
}
type ExecutionResourceRequirements struct {
// +optional
Requests ResourceValues `json:"requests,omitempty"`
// +optional
Limits ResourceValues `json:"limits,omitempty"`
}
// +kubebuilder:validation:XValidation:rule="self.task == oldSelf.task",message="task is immutable"
// +kubebuilder:validation:XValidation:rule="self.resources == oldSelf.resources",message="resources are immutable"
// +kubebuilder:validation:XValidation:rule="has(self.activeDeadlineSeconds) == has(oldSelf.activeDeadlineSeconds) && (!has(self.activeDeadlineSeconds) || self.activeDeadlineSeconds == oldSelf.activeDeadlineSeconds)",message="activeDeadlineSeconds is immutable"
// +kubebuilder:validation:XValidation:rule="has(self.jobClassName) == has(oldSelf.jobClassName) && (!has(self.jobClassName) || self.jobClassName == oldSelf.jobClassName)",message="jobClassName is immutable"
// +kubebuilder:validation:XValidation:rule="oldSelf.desiredState == self.desiredState || (oldSelf.desiredState == 'Running' && self.desiredState == 'Cancelled')",message="desiredState may only transition from Running to Cancelled"
type JobSpec struct {
// +optional
JobClassName string `json:"jobClassName,omitempty"`
Task TaskSpec `json:"task"`
// +optional
Resources ExecutionResourceRequirements `json:"resources,omitempty"`
// +kubebuilder:validation:Minimum=1
// +optional
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
// +kubebuilder:validation:Minimum=0
// +optional
TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"`
// +kubebuilder:validation:Enum=Running;Cancelled
// +kubebuilder:default=Running
// +optional
DesiredState JobDesiredState `json:"desiredState,omitempty"`
}
type ParametersReference struct {
Group string `json:"group"`
Kind string `json:"kind"`
Name string `json:"name"`
// +optional
UID types.UID `json:"uid,omitempty"`
}
type ResolvedJobClassReference struct {
Name string `json:"name"`
UID types.UID `json:"uid"`
ControllerName string `json:"controllerName"`
ParametersRef ParametersReference `json:"parametersRef"`
}
type ExecutionReference struct {
// +kubebuilder:validation:MinLength=1
Type string `json:"type"`
// +kubebuilder:validation:MinLength=1
ID string `json:"id"`
}
type ExecutionStatus struct {
Adapter string `json:"adapter"`
// +listType=map
// +listMapKey=type
// +optional
References []ExecutionReference `json:"references,omitempty"`
}
type JobResult struct {
// +optional
ExitCode *int32 `json:"exitCode,omitempty"`
// +optional
Reason string `json:"reason,omitempty"`
}
type JobStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
// +optional
ResolvedJobClass *ResolvedJobClassReference `json:"resolvedJobClass,omitempty"`
// +optional
EffectiveResources ExecutionResourceRequirements `json:"effectiveResources,omitempty"`
// +optional
Execution *ExecutionStatus `json:"execution,omitempty"`
// +optional
StartTime *metav1.Time `json:"startTime,omitempty"`
// +optional
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
// +optional
Result *JobResult `json:"result,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=='Accepted')].status`
// +kubebuilder:printcolumn:name="Scheduled",type=string,JSONPath=`.status.conditions[?(@.type=='Scheduled')].status`
// +kubebuilder:printcolumn:name="Succeeded",type=string,JSONPath=`.status.conditions[?(@.type=='Succeeded')].status`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
type Job struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitzero"`
Spec JobSpec `json:"spec"`
// +optional
Status JobStatus `json:"status,omitzero"`
}
// +kubebuilder:object:root=true
type JobList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []Job `json:"items"`
}
func init() {
SchemeBuilder.Register(func(s *runtime.Scheme) error {
s.AddKnownTypes(SchemeGroupVersion, &Job{}, &JobList{})
return nil
})
}
+71
View File
@@ -0,0 +1,71 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
const (
JobClassConditionAccepted = "Accepted"
JobClassConditionReady = "Ready"
)
type ExecutionResourcePolicy struct {
// +optional
Defaults ExecutionResourceRequirements `json:"defaults,omitempty"`
// +optional
Minimum ExecutionResourceRequirements `json:"minimum,omitempty"`
// +optional
Maximum ExecutionResourceRequirements `json:"maximum,omitempty"`
}
// +kubebuilder:validation:XValidation:rule="self.controllerName == oldSelf.controllerName",message="controllerName is immutable"
// +kubebuilder:validation:XValidation:rule="self.parametersRef == oldSelf.parametersRef",message="parametersRef is immutable"
type JobClassSpec struct {
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
ControllerName string `json:"controllerName"`
ParametersRef ParametersReference `json:"parametersRef"`
// +optional
AllowedNamespaces *metav1.LabelSelector `json:"allowedNamespaces,omitempty"`
// +optional
Resources ExecutionResourcePolicy `json:"resources,omitempty"`
}
type JobClassStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName`
// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=='Accepted')].status`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].status`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
type JobClass struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitzero"`
Spec JobClassSpec `json:"spec"`
// +optional
Status JobClassStatus `json:"status,omitzero"`
}
// +kubebuilder:object:root=true
type JobClassList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []JobClass `json:"items"`
}
func init() {
SchemeBuilder.Register(func(s *runtime.Scheme) error {
s.AddKnownTypes(SchemeGroupVersion, &JobClass{}, &JobClassList{})
return nil
})
}
@@ -0,0 +1,51 @@
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type KubernetesSchedulingParameters struct {
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}
type KubernetesExecutionParametersSpec struct {
// +kubebuilder:validation:MinLength=1
ServiceAccountName string `json:"serviceAccountName"`
// +optional
RuntimeClassName string `json:"runtimeClassName,omitempty"`
// +optional
Scheduling KubernetesSchedulingParameters `json:"scheduling,omitempty"`
// +optional
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
// +kubebuilder:validation:Enum=Always;Never;IfNotPresent
// +kubebuilder:default=IfNotPresent
// +optional
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
type KubernetesExecutionParameters struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitzero"`
Spec KubernetesExecutionParametersSpec `json:"spec"`
}
// +kubebuilder:object:root=true
type KubernetesExecutionParametersList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []KubernetesExecutionParameters `json:"items"`
}
func init() {
SchemeBuilder.Register(func(s *runtime.Scheme) error {
s.AddKnownTypes(SchemeGroupVersion, &KubernetesExecutionParameters{}, &KubernetesExecutionParametersList{})
return nil
})
}
@@ -0,0 +1,61 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type NamespacedKeyReference struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Key string `json:"key"`
}
type OpenSandboxRequestMapping string
const (
OpenSandboxRequestMappingAdmissionOnly OpenSandboxRequestMapping = "AdmissionOnly"
OpenSandboxRequestMappingNative OpenSandboxRequestMapping = "Native"
)
// +kubebuilder:validation:XValidation:rule="self.allowInsecureHTTP || self.endpoint.startsWith('https://')",message="endpoint must use HTTPS unless allowInsecureHTTP is true"
type OpenSandboxExecutionParametersSpec struct {
// +kubebuilder:validation:MinLength=1
Endpoint string `json:"endpoint"`
APIKeySecretRef NamespacedKeyReference `json:"apiKeySecretRef"`
// +optional
PoolRef string `json:"poolRef,omitempty"`
// +kubebuilder:validation:Enum=AdmissionOnly;Native
// +kubebuilder:default=AdmissionOnly
// +optional
RequestMapping OpenSandboxRequestMapping `json:"requestMapping,omitempty"`
// +optional
AllowSecretEnv bool `json:"allowSecretEnv,omitempty"`
// +optional
AllowImageAuth bool `json:"allowImageAuth,omitempty"`
// AllowInsecureHTTP is intended for isolated development environments only.
// +optional
AllowInsecureHTTP bool `json:"allowInsecureHTTP,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
type OpenSandboxExecutionParameters struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitzero"`
Spec OpenSandboxExecutionParametersSpec `json:"spec"`
}
// +kubebuilder:object:root=true
type OpenSandboxExecutionParametersList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []OpenSandboxExecutionParameters `json:"items"`
}
func init() {
SchemeBuilder.Register(func(s *runtime.Scheme) error {
s.AddKnownTypes(SchemeGroupVersion, &OpenSandboxExecutionParameters{}, &OpenSandboxExecutionParametersList{})
return nil
})
}
+115
View File
@@ -0,0 +1,115 @@
package v1alpha1_test
import (
"context"
"os"
"path/filepath"
"testing"
executionv1alpha1 "git.ddupan.top/panxiao81/ayatori/api/execution/v1alpha1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
)
func TestJobCRDValidation(t *testing.T) {
if os.Getenv("KUBEBUILDER_ASSETS") == "" {
t.Skip("KUBEBUILDER_ASSETS is unset; run make test to execute API integration tests")
}
scheme := runtime.NewScheme()
if err := executionv1alpha1.AddToScheme(scheme); err != nil {
t.Fatal(err)
}
if err := corev1.AddToScheme(scheme); err != nil {
t.Fatal(err)
}
crdPath, err := filepath.Abs("../../../config/crd/bases")
if err != nil {
t.Fatal(err)
}
environment := &envtest.Environment{CRDDirectoryPaths: []string{crdPath}}
config, err := environment.Start()
if err != nil {
t.Fatalf("start envtest: %v", err)
}
t.Cleanup(func() {
if err := environment.Stop(); err != nil {
t.Errorf("stop envtest: %v", err)
}
})
client, err := ctrlclient.New(config, ctrlclient.Options{Scheme: scheme})
if err != nil {
t.Fatal(err)
}
ctx := context.Background()
namespace := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "api-validation"}}
if err := client.Create(ctx, namespace); err != nil {
t.Fatal(err)
}
t.Run("defaults desired state", func(t *testing.T) {
job := validJob("defaults")
if err := client.Create(ctx, job); err != nil {
t.Fatal(err)
}
if job.Spec.DesiredState != executionv1alpha1.JobDesiredStateRunning {
t.Fatalf("desiredState = %q, want Running", job.Spec.DesiredState)
}
})
t.Run("rejects ambiguous environment value", func(t *testing.T) {
literal := "visible"
job := validJob("invalid-env")
job.Spec.Task.Env = []executionv1alpha1.EnvVar{{
Name: "TOKEN",
Value: &literal,
ValueFrom: &executionv1alpha1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: "token"}, Key: "value"},
},
}}
if err := client.Create(ctx, job); !apierrors.IsInvalid(err) {
t.Fatalf("Create() error = %v, want Invalid", err)
}
})
t.Run("rejects immutable task update", func(t *testing.T) {
job := validJob("immutable")
if err := client.Create(ctx, job); err != nil {
t.Fatal(err)
}
job.Spec.Task.Image = "docker.io/library/busybox:1.37"
if err := client.Update(ctx, job); !apierrors.IsInvalid(err) {
t.Fatalf("Update() error = %v, want Invalid", err)
}
})
t.Run("allows one-way cancellation", func(t *testing.T) {
job := validJob("cancel")
if err := client.Create(ctx, job); err != nil {
t.Fatal(err)
}
job.Spec.DesiredState = executionv1alpha1.JobDesiredStateCancelled
if err := client.Update(ctx, job); err != nil {
t.Fatalf("cancel update: %v", err)
}
job.Spec.DesiredState = executionv1alpha1.JobDesiredStateRunning
if err := client.Update(ctx, job); !apierrors.IsInvalid(err) {
t.Fatalf("reverse cancellation error = %v, want Invalid", err)
}
})
}
func validJob(name string) *executionv1alpha1.Job {
return &executionv1alpha1.Job{
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: "api-validation"},
Spec: executionv1alpha1.JobSpec{
Task: executionv1alpha1.TaskSpec{Image: "docker.io/library/alpine:3.22"},
},
}
}
@@ -0,0 +1,676 @@
//go:build !ignore_autogenerated
// Code generated by controller-gen. DO NOT EDIT.
package v1alpha1
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EnvVar) DeepCopyInto(out *EnvVar) {
*out = *in
if in.Value != nil {
in, out := &in.Value, &out.Value
*out = new(string)
**out = **in
}
if in.ValueFrom != nil {
in, out := &in.ValueFrom, &out.ValueFrom
*out = new(EnvVarSource)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVar.
func (in *EnvVar) DeepCopy() *EnvVar {
if in == nil {
return nil
}
out := new(EnvVar)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EnvVarSource) DeepCopyInto(out *EnvVarSource) {
*out = *in
if in.SecretKeyRef != nil {
in, out := &in.SecretKeyRef, &out.SecretKeyRef
*out = new(v1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
if in.ConfigMapKeyRef != nil {
in, out := &in.ConfigMapKeyRef, &out.ConfigMapKeyRef
*out = new(v1.ConfigMapKeySelector)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarSource.
func (in *EnvVarSource) DeepCopy() *EnvVarSource {
if in == nil {
return nil
}
out := new(EnvVarSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExecutionReference) DeepCopyInto(out *ExecutionReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionReference.
func (in *ExecutionReference) DeepCopy() *ExecutionReference {
if in == nil {
return nil
}
out := new(ExecutionReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExecutionResourcePolicy) DeepCopyInto(out *ExecutionResourcePolicy) {
*out = *in
in.Defaults.DeepCopyInto(&out.Defaults)
in.Minimum.DeepCopyInto(&out.Minimum)
in.Maximum.DeepCopyInto(&out.Maximum)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionResourcePolicy.
func (in *ExecutionResourcePolicy) DeepCopy() *ExecutionResourcePolicy {
if in == nil {
return nil
}
out := new(ExecutionResourcePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExecutionResourceRequirements) DeepCopyInto(out *ExecutionResourceRequirements) {
*out = *in
in.Requests.DeepCopyInto(&out.Requests)
in.Limits.DeepCopyInto(&out.Limits)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionResourceRequirements.
func (in *ExecutionResourceRequirements) DeepCopy() *ExecutionResourceRequirements {
if in == nil {
return nil
}
out := new(ExecutionResourceRequirements)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExecutionStatus) DeepCopyInto(out *ExecutionStatus) {
*out = *in
if in.References != nil {
in, out := &in.References, &out.References
*out = make([]ExecutionReference, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionStatus.
func (in *ExecutionStatus) DeepCopy() *ExecutionStatus {
if in == nil {
return nil
}
out := new(ExecutionStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Job) DeepCopyInto(out *Job) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Job.
func (in *Job) DeepCopy() *Job {
if in == nil {
return nil
}
out := new(Job)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Job) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobClass) DeepCopyInto(out *JobClass) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobClass.
func (in *JobClass) DeepCopy() *JobClass {
if in == nil {
return nil
}
out := new(JobClass)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *JobClass) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobClassList) DeepCopyInto(out *JobClassList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]JobClass, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobClassList.
func (in *JobClassList) DeepCopy() *JobClassList {
if in == nil {
return nil
}
out := new(JobClassList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *JobClassList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobClassSpec) DeepCopyInto(out *JobClassSpec) {
*out = *in
out.ParametersRef = in.ParametersRef
if in.AllowedNamespaces != nil {
in, out := &in.AllowedNamespaces, &out.AllowedNamespaces
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
in.Resources.DeepCopyInto(&out.Resources)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobClassSpec.
func (in *JobClassSpec) DeepCopy() *JobClassSpec {
if in == nil {
return nil
}
out := new(JobClassSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobClassStatus) DeepCopyInto(out *JobClassStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobClassStatus.
func (in *JobClassStatus) DeepCopy() *JobClassStatus {
if in == nil {
return nil
}
out := new(JobClassStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobList) DeepCopyInto(out *JobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Job, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobList.
func (in *JobList) DeepCopy() *JobList {
if in == nil {
return nil
}
out := new(JobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *JobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobResult) DeepCopyInto(out *JobResult) {
*out = *in
if in.ExitCode != nil {
in, out := &in.ExitCode, &out.ExitCode
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobResult.
func (in *JobResult) DeepCopy() *JobResult {
if in == nil {
return nil
}
out := new(JobResult)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobSpec) DeepCopyInto(out *JobSpec) {
*out = *in
in.Task.DeepCopyInto(&out.Task)
in.Resources.DeepCopyInto(&out.Resources)
if in.ActiveDeadlineSeconds != nil {
in, out := &in.ActiveDeadlineSeconds, &out.ActiveDeadlineSeconds
*out = new(int64)
**out = **in
}
if in.TTLSecondsAfterFinished != nil {
in, out := &in.TTLSecondsAfterFinished, &out.TTLSecondsAfterFinished
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobSpec.
func (in *JobSpec) DeepCopy() *JobSpec {
if in == nil {
return nil
}
out := new(JobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobStatus) DeepCopyInto(out *JobStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.ResolvedJobClass != nil {
in, out := &in.ResolvedJobClass, &out.ResolvedJobClass
*out = new(ResolvedJobClassReference)
**out = **in
}
in.EffectiveResources.DeepCopyInto(&out.EffectiveResources)
if in.Execution != nil {
in, out := &in.Execution, &out.Execution
*out = new(ExecutionStatus)
(*in).DeepCopyInto(*out)
}
if in.StartTime != nil {
in, out := &in.StartTime, &out.StartTime
*out = (*in).DeepCopy()
}
if in.CompletionTime != nil {
in, out := &in.CompletionTime, &out.CompletionTime
*out = (*in).DeepCopy()
}
if in.Result != nil {
in, out := &in.Result, &out.Result
*out = new(JobResult)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobStatus.
func (in *JobStatus) DeepCopy() *JobStatus {
if in == nil {
return nil
}
out := new(JobStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesExecutionParameters) DeepCopyInto(out *KubernetesExecutionParameters) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesExecutionParameters.
func (in *KubernetesExecutionParameters) DeepCopy() *KubernetesExecutionParameters {
if in == nil {
return nil
}
out := new(KubernetesExecutionParameters)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *KubernetesExecutionParameters) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesExecutionParametersList) DeepCopyInto(out *KubernetesExecutionParametersList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]KubernetesExecutionParameters, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesExecutionParametersList.
func (in *KubernetesExecutionParametersList) DeepCopy() *KubernetesExecutionParametersList {
if in == nil {
return nil
}
out := new(KubernetesExecutionParametersList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *KubernetesExecutionParametersList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesExecutionParametersSpec) DeepCopyInto(out *KubernetesExecutionParametersSpec) {
*out = *in
in.Scheduling.DeepCopyInto(&out.Scheduling)
if in.PodSecurityContext != nil {
in, out := &in.PodSecurityContext, &out.PodSecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesExecutionParametersSpec.
func (in *KubernetesExecutionParametersSpec) DeepCopy() *KubernetesExecutionParametersSpec {
if in == nil {
return nil
}
out := new(KubernetesExecutionParametersSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesSchedulingParameters) DeepCopyInto(out *KubernetesSchedulingParameters) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesSchedulingParameters.
func (in *KubernetesSchedulingParameters) DeepCopy() *KubernetesSchedulingParameters {
if in == nil {
return nil
}
out := new(KubernetesSchedulingParameters)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespacedKeyReference) DeepCopyInto(out *NamespacedKeyReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedKeyReference.
func (in *NamespacedKeyReference) DeepCopy() *NamespacedKeyReference {
if in == nil {
return nil
}
out := new(NamespacedKeyReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenSandboxExecutionParameters) DeepCopyInto(out *OpenSandboxExecutionParameters) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenSandboxExecutionParameters.
func (in *OpenSandboxExecutionParameters) DeepCopy() *OpenSandboxExecutionParameters {
if in == nil {
return nil
}
out := new(OpenSandboxExecutionParameters)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *OpenSandboxExecutionParameters) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenSandboxExecutionParametersList) DeepCopyInto(out *OpenSandboxExecutionParametersList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]OpenSandboxExecutionParameters, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenSandboxExecutionParametersList.
func (in *OpenSandboxExecutionParametersList) DeepCopy() *OpenSandboxExecutionParametersList {
if in == nil {
return nil
}
out := new(OpenSandboxExecutionParametersList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *OpenSandboxExecutionParametersList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenSandboxExecutionParametersSpec) DeepCopyInto(out *OpenSandboxExecutionParametersSpec) {
*out = *in
out.APIKeySecretRef = in.APIKeySecretRef
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenSandboxExecutionParametersSpec.
func (in *OpenSandboxExecutionParametersSpec) DeepCopy() *OpenSandboxExecutionParametersSpec {
if in == nil {
return nil
}
out := new(OpenSandboxExecutionParametersSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ParametersReference) DeepCopyInto(out *ParametersReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParametersReference.
func (in *ParametersReference) DeepCopy() *ParametersReference {
if in == nil {
return nil
}
out := new(ParametersReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResolvedJobClassReference) DeepCopyInto(out *ResolvedJobClassReference) {
*out = *in
out.ParametersRef = in.ParametersRef
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResolvedJobClassReference.
func (in *ResolvedJobClassReference) DeepCopy() *ResolvedJobClassReference {
if in == nil {
return nil
}
out := new(ResolvedJobClassReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceValues) DeepCopyInto(out *ResourceValues) {
*out = *in
if in.CPU != nil {
in, out := &in.CPU, &out.CPU
x := (*in).DeepCopy()
*out = &x
}
if in.Memory != nil {
in, out := &in.Memory, &out.Memory
x := (*in).DeepCopy()
*out = &x
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceValues.
func (in *ResourceValues) DeepCopy() *ResourceValues {
if in == nil {
return nil
}
out := new(ResourceValues)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TaskSpec) DeepCopyInto(out *TaskSpec) {
*out = *in
if in.ImagePullSecrets != nil {
in, out := &in.ImagePullSecrets, &out.ImagePullSecrets
*out = make([]v1.LocalObjectReference, len(*in))
copy(*out, *in)
}
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec.
func (in *TaskSpec) DeepCopy() *TaskSpec {
if in == nil {
return nil
}
out := new(TaskSpec)
in.DeepCopyInto(out)
return out
}