Merge pull request #99423 from soltysh/cronjob_controller
Switch cronjob controller to batch/v1
This commit is contained in:
@@ -65,8 +65,6 @@ API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HPAScalingR
|
|||||||
API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerSpec,Metrics
|
API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerSpec,Metrics
|
||||||
API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerStatus,Conditions
|
API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerStatus,Conditions
|
||||||
API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerStatus,CurrentMetrics
|
API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerStatus,CurrentMetrics
|
||||||
API rule violation: list_type_missing,k8s.io/api/batch/v1,JobStatus,Conditions
|
|
||||||
API rule violation: list_type_missing,k8s.io/api/batch/v1beta1,CronJobStatus,Active
|
|
||||||
API rule violation: list_type_missing,k8s.io/api/core/v1,AvoidPods,PreferAvoidPods
|
API rule violation: list_type_missing,k8s.io/api/core/v1,AvoidPods,PreferAvoidPods
|
||||||
API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Add
|
API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Add
|
||||||
API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Drop
|
API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Drop
|
||||||
|
1404
api/openapi-spec/swagger.json
generated
1404
api/openapi-spec/swagger.json
generated
File diff suppressed because it is too large
Load Diff
@@ -44,12 +44,12 @@ func startJobController(ctx ControllerContext) (http.Handler, bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startCronJobController(ctx ControllerContext) (http.Handler, bool, error) {
|
func startCronJobController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"}] {
|
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "cronjobs"}] {
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.CronJobControllerV2) {
|
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.CronJobControllerV2) {
|
||||||
cj2c, err := cronjob.NewControllerV2(ctx.InformerFactory.Batch().V1().Jobs(),
|
cj2c, err := cronjob.NewControllerV2(ctx.InformerFactory.Batch().V1().Jobs(),
|
||||||
ctx.InformerFactory.Batch().V1beta1().CronJobs(),
|
ctx.InformerFactory.Batch().V1().CronJobs(),
|
||||||
ctx.ClientBuilder.ClientOrDie("cronjob-controller"),
|
ctx.ClientBuilder.ClientOrDie("cronjob-controller"),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -81,6 +81,8 @@ func TestDefaulting(t *testing.T) {
|
|||||||
{Group: "autoscaling", Version: "v2beta1", Kind: "HorizontalPodAutoscalerList"}: {},
|
{Group: "autoscaling", Version: "v2beta1", Kind: "HorizontalPodAutoscalerList"}: {},
|
||||||
{Group: "autoscaling", Version: "v2beta2", Kind: "HorizontalPodAutoscaler"}: {},
|
{Group: "autoscaling", Version: "v2beta2", Kind: "HorizontalPodAutoscaler"}: {},
|
||||||
{Group: "autoscaling", Version: "v2beta2", Kind: "HorizontalPodAutoscalerList"}: {},
|
{Group: "autoscaling", Version: "v2beta2", Kind: "HorizontalPodAutoscalerList"}: {},
|
||||||
|
{Group: "batch", Version: "v1", Kind: "CronJob"}: {},
|
||||||
|
{Group: "batch", Version: "v1", Kind: "CronJobList"}: {},
|
||||||
{Group: "batch", Version: "v1", Kind: "Job"}: {},
|
{Group: "batch", Version: "v1", Kind: "Job"}: {},
|
||||||
{Group: "batch", Version: "v1", Kind: "JobList"}: {},
|
{Group: "batch", Version: "v1", Kind: "JobList"}: {},
|
||||||
{Group: "batch", Version: "v1beta1", Kind: "CronJob"}: {},
|
{Group: "batch", Version: "v1beta1", Kind: "CronJob"}: {},
|
||||||
|
@@ -364,4 +364,8 @@ type CronJobStatus struct {
|
|||||||
// Information when was the last time the job was successfully scheduled.
|
// Information when was the last time the job was successfully scheduled.
|
||||||
// +optional
|
// +optional
|
||||||
LastScheduleTime *metav1.Time
|
LastScheduleTime *metav1.Time
|
||||||
|
|
||||||
|
// Information when was the last time the job successfully completed.
|
||||||
|
// +optional
|
||||||
|
LastSuccessfulTime *metav1.Time
|
||||||
}
|
}
|
||||||
|
@@ -32,14 +32,13 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
|||||||
case "metadata.name", "metadata.namespace", "status.successful":
|
case "metadata.name", "metadata.namespace", "status.successful":
|
||||||
return label, value, nil
|
return label, value, nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("field label %q not supported for batchv1.Job", label)
|
return "", "", fmt.Errorf("field label %q not supported for Job", label)
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following functions don't do anything special, but they need to be added
|
// The following functions don't do anything special, but they need to be added
|
||||||
// here due to the dependency of v1beta1 and v2alpha1 on v1.
|
// here due to the dependency of v1beta1 on v1.
|
||||||
|
|
||||||
func Convert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *v1.JobSpec, s conversion.Scope) error {
|
func Convert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *v1.JobSpec, s conversion.Scope) error {
|
||||||
return autoConvert_batch_JobSpec_To_v1_JobSpec(in, out, s)
|
return autoConvert_batch_JobSpec_To_v1_JobSpec(in, out, s)
|
||||||
|
@@ -19,6 +19,7 @@ package v1
|
|||||||
import (
|
import (
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
utilpointer "k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
@@ -29,18 +30,14 @@ func SetDefaults_Job(obj *batchv1.Job) {
|
|||||||
// For a non-parallel job, you can leave both `.spec.completions` and
|
// For a non-parallel job, you can leave both `.spec.completions` and
|
||||||
// `.spec.parallelism` unset. When both are unset, both are defaulted to 1.
|
// `.spec.parallelism` unset. When both are unset, both are defaulted to 1.
|
||||||
if obj.Spec.Completions == nil && obj.Spec.Parallelism == nil {
|
if obj.Spec.Completions == nil && obj.Spec.Parallelism == nil {
|
||||||
obj.Spec.Completions = new(int32)
|
obj.Spec.Completions = utilpointer.Int32Ptr(1)
|
||||||
*obj.Spec.Completions = 1
|
obj.Spec.Parallelism = utilpointer.Int32Ptr(1)
|
||||||
obj.Spec.Parallelism = new(int32)
|
|
||||||
*obj.Spec.Parallelism = 1
|
|
||||||
}
|
}
|
||||||
if obj.Spec.Parallelism == nil {
|
if obj.Spec.Parallelism == nil {
|
||||||
obj.Spec.Parallelism = new(int32)
|
obj.Spec.Parallelism = utilpointer.Int32Ptr(1)
|
||||||
*obj.Spec.Parallelism = 1
|
|
||||||
}
|
}
|
||||||
if obj.Spec.BackoffLimit == nil {
|
if obj.Spec.BackoffLimit == nil {
|
||||||
obj.Spec.BackoffLimit = new(int32)
|
obj.Spec.BackoffLimit = utilpointer.Int32Ptr(6)
|
||||||
*obj.Spec.BackoffLimit = 6
|
|
||||||
}
|
}
|
||||||
labels := obj.Spec.Template.Labels
|
labels := obj.Spec.Template.Labels
|
||||||
if labels != nil && len(obj.Labels) == 0 {
|
if labels != nil && len(obj.Labels) == 0 {
|
||||||
@@ -50,3 +47,18 @@ func SetDefaults_Job(obj *batchv1.Job) {
|
|||||||
obj.Spec.CompletionMode = batchv1.NonIndexedCompletion
|
obj.Spec.CompletionMode = batchv1.NonIndexedCompletion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaults_CronJob(obj *batchv1.CronJob) {
|
||||||
|
if obj.Spec.ConcurrencyPolicy == "" {
|
||||||
|
obj.Spec.ConcurrencyPolicy = batchv1.AllowConcurrent
|
||||||
|
}
|
||||||
|
if obj.Spec.Suspend == nil {
|
||||||
|
obj.Spec.Suspend = utilpointer.BoolPtr(false)
|
||||||
|
}
|
||||||
|
if obj.Spec.SuccessfulJobsHistoryLimit == nil {
|
||||||
|
obj.Spec.SuccessfulJobsHistoryLimit = utilpointer.Int32Ptr(3)
|
||||||
|
}
|
||||||
|
if obj.Spec.FailedJobsHistoryLimit == nil {
|
||||||
|
obj.Spec.FailedJobsHistoryLimit = utilpointer.Int32Ptr(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -259,3 +259,69 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
|||||||
}
|
}
|
||||||
return obj3
|
return obj3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSetDefaultCronJob(t *testing.T) {
|
||||||
|
tests := map[string]struct {
|
||||||
|
original *batchv1.CronJob
|
||||||
|
expected *batchv1.CronJob
|
||||||
|
}{
|
||||||
|
"empty batchv1.CronJob should default batchv1.ConcurrencyPolicy and Suspend": {
|
||||||
|
original: &batchv1.CronJob{},
|
||||||
|
expected: &batchv1.CronJob{
|
||||||
|
Spec: batchv1.CronJobSpec{
|
||||||
|
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||||
|
Suspend: newBool(false),
|
||||||
|
SuccessfulJobsHistoryLimit: utilpointer.Int32Ptr(3),
|
||||||
|
FailedJobsHistoryLimit: utilpointer.Int32Ptr(1),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"set fields should not be defaulted": {
|
||||||
|
original: &batchv1.CronJob{
|
||||||
|
Spec: batchv1.CronJobSpec{
|
||||||
|
ConcurrencyPolicy: batchv1.ForbidConcurrent,
|
||||||
|
Suspend: newBool(true),
|
||||||
|
SuccessfulJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||||
|
FailedJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: &batchv1.CronJob{
|
||||||
|
Spec: batchv1.CronJobSpec{
|
||||||
|
ConcurrencyPolicy: batchv1.ForbidConcurrent,
|
||||||
|
Suspend: newBool(true),
|
||||||
|
SuccessfulJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||||
|
FailedJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, test := range tests {
|
||||||
|
original := test.original
|
||||||
|
expected := test.expected
|
||||||
|
obj2 := roundTrip(t, runtime.Object(original))
|
||||||
|
actual, ok := obj2.(*batchv1.CronJob)
|
||||||
|
if !ok {
|
||||||
|
t.Errorf("%s: unexpected object: %v", name, actual)
|
||||||
|
t.FailNow()
|
||||||
|
}
|
||||||
|
if actual.Spec.ConcurrencyPolicy != expected.Spec.ConcurrencyPolicy {
|
||||||
|
t.Errorf("%s: got different concurrencyPolicy than expected: %v %v", name, actual.Spec.ConcurrencyPolicy, expected.Spec.ConcurrencyPolicy)
|
||||||
|
}
|
||||||
|
if *actual.Spec.Suspend != *expected.Spec.Suspend {
|
||||||
|
t.Errorf("%s: got different suspend than expected: %v %v", name, *actual.Spec.Suspend, *expected.Spec.Suspend)
|
||||||
|
}
|
||||||
|
if *actual.Spec.SuccessfulJobsHistoryLimit != *expected.Spec.SuccessfulJobsHistoryLimit {
|
||||||
|
t.Errorf("%s: got different successfulJobsHistoryLimit than expected: %v %v", name, *actual.Spec.SuccessfulJobsHistoryLimit, *expected.Spec.SuccessfulJobsHistoryLimit)
|
||||||
|
}
|
||||||
|
if *actual.Spec.FailedJobsHistoryLimit != *expected.Spec.FailedJobsHistoryLimit {
|
||||||
|
t.Errorf("%s: got different failedJobsHistoryLimit than expected: %v %v", name, *actual.Spec.FailedJobsHistoryLimit, *expected.Spec.FailedJobsHistoryLimit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func newBool(val bool) *bool {
|
||||||
|
p := new(bool)
|
||||||
|
*p = val
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
210
pkg/apis/batch/v1/zz_generated.conversion.go
generated
210
pkg/apis/batch/v1/zz_generated.conversion.go
generated
@@ -40,6 +40,46 @@ func init() {
|
|||||||
// RegisterConversions adds conversion functions to the given scheme.
|
// RegisterConversions adds conversion functions to the given scheme.
|
||||||
// Public to allow building arbitrary schemes.
|
// Public to allow building arbitrary schemes.
|
||||||
func RegisterConversions(s *runtime.Scheme) error {
|
func RegisterConversions(s *runtime.Scheme) error {
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1.CronJob)(nil), (*batch.CronJob)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_CronJob_To_batch_CronJob(a.(*v1.CronJob), b.(*batch.CronJob), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*batch.CronJob)(nil), (*v1.CronJob)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_batch_CronJob_To_v1_CronJob(a.(*batch.CronJob), b.(*v1.CronJob), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1.CronJobList)(nil), (*batch.CronJobList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_CronJobList_To_batch_CronJobList(a.(*v1.CronJobList), b.(*batch.CronJobList), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*batch.CronJobList)(nil), (*v1.CronJobList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_batch_CronJobList_To_v1_CronJobList(a.(*batch.CronJobList), b.(*v1.CronJobList), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1.CronJobSpec)(nil), (*batch.CronJobSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_CronJobSpec_To_batch_CronJobSpec(a.(*v1.CronJobSpec), b.(*batch.CronJobSpec), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*batch.CronJobSpec)(nil), (*v1.CronJobSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_batch_CronJobSpec_To_v1_CronJobSpec(a.(*batch.CronJobSpec), b.(*v1.CronJobSpec), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1.CronJobStatus)(nil), (*batch.CronJobStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_CronJobStatus_To_batch_CronJobStatus(a.(*v1.CronJobStatus), b.(*batch.CronJobStatus), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*batch.CronJobStatus)(nil), (*v1.CronJobStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_batch_CronJobStatus_To_v1_CronJobStatus(a.(*batch.CronJobStatus), b.(*v1.CronJobStatus), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddGeneratedConversionFunc((*v1.Job)(nil), (*batch.Job)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddGeneratedConversionFunc((*v1.Job)(nil), (*batch.Job)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_v1_Job_To_batch_Job(a.(*v1.Job), b.(*batch.Job), scope)
|
return Convert_v1_Job_To_batch_Job(a.(*v1.Job), b.(*batch.Job), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -80,6 +120,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1.JobTemplateSpec)(nil), (*batch.JobTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_JobTemplateSpec_To_batch_JobTemplateSpec(a.(*v1.JobTemplateSpec), b.(*batch.JobTemplateSpec), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*batch.JobTemplateSpec)(nil), (*v1.JobTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_batch_JobTemplateSpec_To_v1_JobTemplateSpec(a.(*batch.JobTemplateSpec), b.(*v1.JobTemplateSpec), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddConversionFunc((*batch.JobSpec)(nil), (*v1.JobSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddConversionFunc((*batch.JobSpec)(nil), (*v1.JobSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_batch_JobSpec_To_v1_JobSpec(a.(*batch.JobSpec), b.(*v1.JobSpec), scope)
|
return Convert_batch_JobSpec_To_v1_JobSpec(a.(*batch.JobSpec), b.(*v1.JobSpec), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -93,6 +143,140 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_CronJob_To_batch_CronJob(in *v1.CronJob, out *batch.CronJob, s conversion.Scope) error {
|
||||||
|
out.ObjectMeta = in.ObjectMeta
|
||||||
|
if err := Convert_v1_CronJobSpec_To_batch_CronJobSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := Convert_v1_CronJobStatus_To_batch_CronJobStatus(&in.Status, &out.Status, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_CronJob_To_batch_CronJob is an autogenerated conversion function.
|
||||||
|
func Convert_v1_CronJob_To_batch_CronJob(in *v1.CronJob, out *batch.CronJob, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_CronJob_To_batch_CronJob(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_batch_CronJob_To_v1_CronJob(in *batch.CronJob, out *v1.CronJob, s conversion.Scope) error {
|
||||||
|
out.ObjectMeta = in.ObjectMeta
|
||||||
|
if err := Convert_batch_CronJobSpec_To_v1_CronJobSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := Convert_batch_CronJobStatus_To_v1_CronJobStatus(&in.Status, &out.Status, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_batch_CronJob_To_v1_CronJob is an autogenerated conversion function.
|
||||||
|
func Convert_batch_CronJob_To_v1_CronJob(in *batch.CronJob, out *v1.CronJob, s conversion.Scope) error {
|
||||||
|
return autoConvert_batch_CronJob_To_v1_CronJob(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_CronJobList_To_batch_CronJobList(in *v1.CronJobList, out *batch.CronJobList, s conversion.Scope) error {
|
||||||
|
out.ListMeta = in.ListMeta
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]batch.CronJob, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
if err := Convert_v1_CronJob_To_batch_CronJob(&(*in)[i], &(*out)[i], s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out.Items = nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_CronJobList_To_batch_CronJobList is an autogenerated conversion function.
|
||||||
|
func Convert_v1_CronJobList_To_batch_CronJobList(in *v1.CronJobList, out *batch.CronJobList, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_CronJobList_To_batch_CronJobList(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_batch_CronJobList_To_v1_CronJobList(in *batch.CronJobList, out *v1.CronJobList, s conversion.Scope) error {
|
||||||
|
out.ListMeta = in.ListMeta
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]v1.CronJob, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
if err := Convert_batch_CronJob_To_v1_CronJob(&(*in)[i], &(*out)[i], s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out.Items = nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_batch_CronJobList_To_v1_CronJobList is an autogenerated conversion function.
|
||||||
|
func Convert_batch_CronJobList_To_v1_CronJobList(in *batch.CronJobList, out *v1.CronJobList, s conversion.Scope) error {
|
||||||
|
return autoConvert_batch_CronJobList_To_v1_CronJobList(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_CronJobSpec_To_batch_CronJobSpec(in *v1.CronJobSpec, out *batch.CronJobSpec, s conversion.Scope) error {
|
||||||
|
out.Schedule = in.Schedule
|
||||||
|
out.StartingDeadlineSeconds = (*int64)(unsafe.Pointer(in.StartingDeadlineSeconds))
|
||||||
|
out.ConcurrencyPolicy = batch.ConcurrencyPolicy(in.ConcurrencyPolicy)
|
||||||
|
out.Suspend = (*bool)(unsafe.Pointer(in.Suspend))
|
||||||
|
if err := Convert_v1_JobTemplateSpec_To_batch_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
out.SuccessfulJobsHistoryLimit = (*int32)(unsafe.Pointer(in.SuccessfulJobsHistoryLimit))
|
||||||
|
out.FailedJobsHistoryLimit = (*int32)(unsafe.Pointer(in.FailedJobsHistoryLimit))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_CronJobSpec_To_batch_CronJobSpec is an autogenerated conversion function.
|
||||||
|
func Convert_v1_CronJobSpec_To_batch_CronJobSpec(in *v1.CronJobSpec, out *batch.CronJobSpec, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_CronJobSpec_To_batch_CronJobSpec(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_batch_CronJobSpec_To_v1_CronJobSpec(in *batch.CronJobSpec, out *v1.CronJobSpec, s conversion.Scope) error {
|
||||||
|
out.Schedule = in.Schedule
|
||||||
|
out.StartingDeadlineSeconds = (*int64)(unsafe.Pointer(in.StartingDeadlineSeconds))
|
||||||
|
out.ConcurrencyPolicy = v1.ConcurrencyPolicy(in.ConcurrencyPolicy)
|
||||||
|
out.Suspend = (*bool)(unsafe.Pointer(in.Suspend))
|
||||||
|
if err := Convert_batch_JobTemplateSpec_To_v1_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
out.SuccessfulJobsHistoryLimit = (*int32)(unsafe.Pointer(in.SuccessfulJobsHistoryLimit))
|
||||||
|
out.FailedJobsHistoryLimit = (*int32)(unsafe.Pointer(in.FailedJobsHistoryLimit))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_batch_CronJobSpec_To_v1_CronJobSpec is an autogenerated conversion function.
|
||||||
|
func Convert_batch_CronJobSpec_To_v1_CronJobSpec(in *batch.CronJobSpec, out *v1.CronJobSpec, s conversion.Scope) error {
|
||||||
|
return autoConvert_batch_CronJobSpec_To_v1_CronJobSpec(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_CronJobStatus_To_batch_CronJobStatus(in *v1.CronJobStatus, out *batch.CronJobStatus, s conversion.Scope) error {
|
||||||
|
out.Active = *(*[]core.ObjectReference)(unsafe.Pointer(&in.Active))
|
||||||
|
out.LastScheduleTime = (*metav1.Time)(unsafe.Pointer(in.LastScheduleTime))
|
||||||
|
out.LastSuccessfulTime = (*metav1.Time)(unsafe.Pointer(in.LastSuccessfulTime))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_CronJobStatus_To_batch_CronJobStatus is an autogenerated conversion function.
|
||||||
|
func Convert_v1_CronJobStatus_To_batch_CronJobStatus(in *v1.CronJobStatus, out *batch.CronJobStatus, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_CronJobStatus_To_batch_CronJobStatus(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_batch_CronJobStatus_To_v1_CronJobStatus(in *batch.CronJobStatus, out *v1.CronJobStatus, s conversion.Scope) error {
|
||||||
|
out.Active = *(*[]corev1.ObjectReference)(unsafe.Pointer(&in.Active))
|
||||||
|
out.LastScheduleTime = (*metav1.Time)(unsafe.Pointer(in.LastScheduleTime))
|
||||||
|
out.LastSuccessfulTime = (*metav1.Time)(unsafe.Pointer(in.LastSuccessfulTime))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_batch_CronJobStatus_To_v1_CronJobStatus is an autogenerated conversion function.
|
||||||
|
func Convert_batch_CronJobStatus_To_v1_CronJobStatus(in *batch.CronJobStatus, out *v1.CronJobStatus, s conversion.Scope) error {
|
||||||
|
return autoConvert_batch_CronJobStatus_To_v1_CronJobStatus(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_v1_Job_To_batch_Job(in *v1.Job, out *batch.Job, s conversion.Scope) error {
|
func autoConvert_v1_Job_To_batch_Job(in *v1.Job, out *batch.Job, s conversion.Scope) error {
|
||||||
out.ObjectMeta = in.ObjectMeta
|
out.ObjectMeta = in.ObjectMeta
|
||||||
if err := Convert_v1_JobSpec_To_batch_JobSpec(&in.Spec, &out.Spec, s); err != nil {
|
if err := Convert_v1_JobSpec_To_batch_JobSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||||
@@ -258,3 +442,29 @@ func autoConvert_batch_JobStatus_To_v1_JobStatus(in *batch.JobStatus, out *v1.Jo
|
|||||||
func Convert_batch_JobStatus_To_v1_JobStatus(in *batch.JobStatus, out *v1.JobStatus, s conversion.Scope) error {
|
func Convert_batch_JobStatus_To_v1_JobStatus(in *batch.JobStatus, out *v1.JobStatus, s conversion.Scope) error {
|
||||||
return autoConvert_batch_JobStatus_To_v1_JobStatus(in, out, s)
|
return autoConvert_batch_JobStatus_To_v1_JobStatus(in, out, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_JobTemplateSpec_To_batch_JobTemplateSpec(in *v1.JobTemplateSpec, out *batch.JobTemplateSpec, s conversion.Scope) error {
|
||||||
|
out.ObjectMeta = in.ObjectMeta
|
||||||
|
if err := Convert_v1_JobSpec_To_batch_JobSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_JobTemplateSpec_To_batch_JobTemplateSpec is an autogenerated conversion function.
|
||||||
|
func Convert_v1_JobTemplateSpec_To_batch_JobTemplateSpec(in *v1.JobTemplateSpec, out *batch.JobTemplateSpec, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_JobTemplateSpec_To_batch_JobTemplateSpec(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_batch_JobTemplateSpec_To_v1_JobTemplateSpec(in *batch.JobTemplateSpec, out *v1.JobTemplateSpec, s conversion.Scope) error {
|
||||||
|
out.ObjectMeta = in.ObjectMeta
|
||||||
|
if err := Convert_batch_JobSpec_To_v1_JobSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_batch_JobTemplateSpec_To_v1_JobTemplateSpec is an autogenerated conversion function.
|
||||||
|
func Convert_batch_JobTemplateSpec_To_v1_JobTemplateSpec(in *batch.JobTemplateSpec, out *v1.JobTemplateSpec, s conversion.Scope) error {
|
||||||
|
return autoConvert_batch_JobTemplateSpec_To_v1_JobTemplateSpec(in, out, s)
|
||||||
|
}
|
||||||
|
223
pkg/apis/batch/v1/zz_generated.defaults.go
generated
223
pkg/apis/batch/v1/zz_generated.defaults.go
generated
@@ -30,11 +30,234 @@ import (
|
|||||||
// Public to allow building arbitrary schemes.
|
// Public to allow building arbitrary schemes.
|
||||||
// All generated defaulters are covering - they call all nested defaulters.
|
// All generated defaulters are covering - they call all nested defaulters.
|
||||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1.CronJob{}, func(obj interface{}) { SetObjectDefaults_CronJob(obj.(*v1.CronJob)) })
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1.CronJobList{}, func(obj interface{}) { SetObjectDefaults_CronJobList(obj.(*v1.CronJobList)) })
|
||||||
scheme.AddTypeDefaultingFunc(&v1.Job{}, func(obj interface{}) { SetObjectDefaults_Job(obj.(*v1.Job)) })
|
scheme.AddTypeDefaultingFunc(&v1.Job{}, func(obj interface{}) { SetObjectDefaults_Job(obj.(*v1.Job)) })
|
||||||
scheme.AddTypeDefaultingFunc(&v1.JobList{}, func(obj interface{}) { SetObjectDefaults_JobList(obj.(*v1.JobList)) })
|
scheme.AddTypeDefaultingFunc(&v1.JobList{}, func(obj interface{}) { SetObjectDefaults_JobList(obj.(*v1.JobList)) })
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_CronJob(in *v1.CronJob) {
|
||||||
|
SetDefaults_CronJob(in)
|
||||||
|
corev1.SetDefaults_PodSpec(&in.Spec.JobTemplate.Spec.Template.Spec)
|
||||||
|
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Volumes {
|
||||||
|
a := &in.Spec.JobTemplate.Spec.Template.Spec.Volumes[i]
|
||||||
|
corev1.SetDefaults_Volume(a)
|
||||||
|
if a.VolumeSource.HostPath != nil {
|
||||||
|
corev1.SetDefaults_HostPathVolumeSource(a.VolumeSource.HostPath)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.Secret != nil {
|
||||||
|
corev1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.ISCSI != nil {
|
||||||
|
corev1.SetDefaults_ISCSIVolumeSource(a.VolumeSource.ISCSI)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.RBD != nil {
|
||||||
|
corev1.SetDefaults_RBDVolumeSource(a.VolumeSource.RBD)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.DownwardAPI != nil {
|
||||||
|
corev1.SetDefaults_DownwardAPIVolumeSource(a.VolumeSource.DownwardAPI)
|
||||||
|
for j := range a.VolumeSource.DownwardAPI.Items {
|
||||||
|
b := &a.VolumeSource.DownwardAPI.Items[j]
|
||||||
|
if b.FieldRef != nil {
|
||||||
|
corev1.SetDefaults_ObjectFieldSelector(b.FieldRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.VolumeSource.ConfigMap != nil {
|
||||||
|
corev1.SetDefaults_ConfigMapVolumeSource(a.VolumeSource.ConfigMap)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.AzureDisk != nil {
|
||||||
|
corev1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.Projected != nil {
|
||||||
|
corev1.SetDefaults_ProjectedVolumeSource(a.VolumeSource.Projected)
|
||||||
|
for j := range a.VolumeSource.Projected.Sources {
|
||||||
|
b := &a.VolumeSource.Projected.Sources[j]
|
||||||
|
if b.DownwardAPI != nil {
|
||||||
|
for k := range b.DownwardAPI.Items {
|
||||||
|
c := &b.DownwardAPI.Items[k]
|
||||||
|
if c.FieldRef != nil {
|
||||||
|
corev1.SetDefaults_ObjectFieldSelector(c.FieldRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if b.ServiceAccountToken != nil {
|
||||||
|
corev1.SetDefaults_ServiceAccountTokenProjection(b.ServiceAccountToken)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.VolumeSource.ScaleIO != nil {
|
||||||
|
corev1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
|
||||||
|
}
|
||||||
|
if a.VolumeSource.Ephemeral != nil {
|
||||||
|
if a.VolumeSource.Ephemeral.VolumeClaimTemplate != nil {
|
||||||
|
corev1.SetDefaults_PersistentVolumeClaimSpec(&a.VolumeSource.Ephemeral.VolumeClaimTemplate.Spec)
|
||||||
|
corev1.SetDefaults_ResourceList(&a.VolumeSource.Ephemeral.VolumeClaimTemplate.Spec.Resources.Limits)
|
||||||
|
corev1.SetDefaults_ResourceList(&a.VolumeSource.Ephemeral.VolumeClaimTemplate.Spec.Resources.Requests)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
|
||||||
|
a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i]
|
||||||
|
corev1.SetDefaults_Container(a)
|
||||||
|
for j := range a.Ports {
|
||||||
|
b := &a.Ports[j]
|
||||||
|
if b.Protocol == "" {
|
||||||
|
b.Protocol = "TCP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for j := range a.Env {
|
||||||
|
b := &a.Env[j]
|
||||||
|
if b.ValueFrom != nil {
|
||||||
|
if b.ValueFrom.FieldRef != nil {
|
||||||
|
corev1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
corev1.SetDefaults_ResourceList(&a.Resources.Limits)
|
||||||
|
corev1.SetDefaults_ResourceList(&a.Resources.Requests)
|
||||||
|
if a.LivenessProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.LivenessProbe)
|
||||||
|
if a.LivenessProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.ReadinessProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.ReadinessProbe)
|
||||||
|
if a.ReadinessProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.StartupProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.StartupProbe)
|
||||||
|
if a.StartupProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.Lifecycle != nil {
|
||||||
|
if a.Lifecycle.PostStart != nil {
|
||||||
|
if a.Lifecycle.PostStart.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.Lifecycle.PreStop != nil {
|
||||||
|
if a.Lifecycle.PreStop.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Containers {
|
||||||
|
a := &in.Spec.JobTemplate.Spec.Template.Spec.Containers[i]
|
||||||
|
corev1.SetDefaults_Container(a)
|
||||||
|
for j := range a.Ports {
|
||||||
|
b := &a.Ports[j]
|
||||||
|
if b.Protocol == "" {
|
||||||
|
b.Protocol = "TCP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for j := range a.Env {
|
||||||
|
b := &a.Env[j]
|
||||||
|
if b.ValueFrom != nil {
|
||||||
|
if b.ValueFrom.FieldRef != nil {
|
||||||
|
corev1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
corev1.SetDefaults_ResourceList(&a.Resources.Limits)
|
||||||
|
corev1.SetDefaults_ResourceList(&a.Resources.Requests)
|
||||||
|
if a.LivenessProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.LivenessProbe)
|
||||||
|
if a.LivenessProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.ReadinessProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.ReadinessProbe)
|
||||||
|
if a.ReadinessProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.StartupProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.StartupProbe)
|
||||||
|
if a.StartupProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.Lifecycle != nil {
|
||||||
|
if a.Lifecycle.PostStart != nil {
|
||||||
|
if a.Lifecycle.PostStart.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.Lifecycle.PreStop != nil {
|
||||||
|
if a.Lifecycle.PreStop.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i := range in.Spec.JobTemplate.Spec.Template.Spec.EphemeralContainers {
|
||||||
|
a := &in.Spec.JobTemplate.Spec.Template.Spec.EphemeralContainers[i]
|
||||||
|
corev1.SetDefaults_EphemeralContainer(a)
|
||||||
|
for j := range a.EphemeralContainerCommon.Ports {
|
||||||
|
b := &a.EphemeralContainerCommon.Ports[j]
|
||||||
|
if b.Protocol == "" {
|
||||||
|
b.Protocol = "TCP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for j := range a.EphemeralContainerCommon.Env {
|
||||||
|
b := &a.EphemeralContainerCommon.Env[j]
|
||||||
|
if b.ValueFrom != nil {
|
||||||
|
if b.ValueFrom.FieldRef != nil {
|
||||||
|
corev1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
corev1.SetDefaults_ResourceList(&a.EphemeralContainerCommon.Resources.Limits)
|
||||||
|
corev1.SetDefaults_ResourceList(&a.EphemeralContainerCommon.Resources.Requests)
|
||||||
|
if a.EphemeralContainerCommon.LivenessProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.EphemeralContainerCommon.LivenessProbe)
|
||||||
|
if a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.EphemeralContainerCommon.ReadinessProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.EphemeralContainerCommon.ReadinessProbe)
|
||||||
|
if a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.EphemeralContainerCommon.StartupProbe != nil {
|
||||||
|
corev1.SetDefaults_Probe(a.EphemeralContainerCommon.StartupProbe)
|
||||||
|
if a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.EphemeralContainerCommon.Lifecycle != nil {
|
||||||
|
if a.EphemeralContainerCommon.Lifecycle.PostStart != nil {
|
||||||
|
if a.EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if a.EphemeralContainerCommon.Lifecycle.PreStop != nil {
|
||||||
|
if a.EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet != nil {
|
||||||
|
corev1.SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
corev1.SetDefaults_ResourceList(&in.Spec.JobTemplate.Spec.Template.Spec.Overhead)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_CronJobList(in *v1.CronJobList) {
|
||||||
|
for i := range in.Items {
|
||||||
|
a := &in.Items[i]
|
||||||
|
SetObjectDefaults_CronJob(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func SetObjectDefaults_Job(in *v1.Job) {
|
func SetObjectDefaults_Job(in *v1.Job) {
|
||||||
SetDefaults_Job(in)
|
SetDefaults_Job(in)
|
||||||
corev1.SetDefaults_PodSpec(&in.Spec.Template.Spec)
|
corev1.SetDefaults_PodSpec(&in.Spec.Template.Spec)
|
||||||
|
@@ -216,6 +216,7 @@ func Convert_batch_CronJobSpec_To_v1beta1_CronJobSpec(in *batch.CronJobSpec, out
|
|||||||
func autoConvert_v1beta1_CronJobStatus_To_batch_CronJobStatus(in *v1beta1.CronJobStatus, out *batch.CronJobStatus, s conversion.Scope) error {
|
func autoConvert_v1beta1_CronJobStatus_To_batch_CronJobStatus(in *v1beta1.CronJobStatus, out *batch.CronJobStatus, s conversion.Scope) error {
|
||||||
out.Active = *(*[]core.ObjectReference)(unsafe.Pointer(&in.Active))
|
out.Active = *(*[]core.ObjectReference)(unsafe.Pointer(&in.Active))
|
||||||
out.LastScheduleTime = (*v1.Time)(unsafe.Pointer(in.LastScheduleTime))
|
out.LastScheduleTime = (*v1.Time)(unsafe.Pointer(in.LastScheduleTime))
|
||||||
|
out.LastSuccessfulTime = (*v1.Time)(unsafe.Pointer(in.LastSuccessfulTime))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,6 +228,7 @@ func Convert_v1beta1_CronJobStatus_To_batch_CronJobStatus(in *v1beta1.CronJobSta
|
|||||||
func autoConvert_batch_CronJobStatus_To_v1beta1_CronJobStatus(in *batch.CronJobStatus, out *v1beta1.CronJobStatus, s conversion.Scope) error {
|
func autoConvert_batch_CronJobStatus_To_v1beta1_CronJobStatus(in *batch.CronJobStatus, out *v1beta1.CronJobStatus, s conversion.Scope) error {
|
||||||
out.Active = *(*[]corev1.ObjectReference)(unsafe.Pointer(&in.Active))
|
out.Active = *(*[]corev1.ObjectReference)(unsafe.Pointer(&in.Active))
|
||||||
out.LastScheduleTime = (*v1.Time)(unsafe.Pointer(in.LastScheduleTime))
|
out.LastScheduleTime = (*v1.Time)(unsafe.Pointer(in.LastScheduleTime))
|
||||||
|
out.LastSuccessfulTime = (*v1.Time)(unsafe.Pointer(in.LastSuccessfulTime))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
pkg/apis/batch/zz_generated.deepcopy.go
generated
4
pkg/apis/batch/zz_generated.deepcopy.go
generated
@@ -136,6 +136,10 @@ func (in *CronJobStatus) DeepCopyInto(out *CronJobStatus) {
|
|||||||
in, out := &in.LastScheduleTime, &out.LastScheduleTime
|
in, out := &in.LastScheduleTime, &out.LastScheduleTime
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
|
if in.LastSuccessfulTime != nil {
|
||||||
|
in, out := &in.LastSuccessfulTime, &out.LastSuccessfulTime
|
||||||
|
*out = (*in).DeepCopy()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@ import (
|
|||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@@ -56,7 +55,7 @@ import (
|
|||||||
// Utilities for dealing with Jobs and CronJobs and time.
|
// Utilities for dealing with Jobs and CronJobs and time.
|
||||||
|
|
||||||
// controllerKind contains the schema.GroupVersionKind for this controller type.
|
// controllerKind contains the schema.GroupVersionKind for this controller type.
|
||||||
var controllerKind = batchv1beta1.SchemeGroupVersion.WithKind("CronJob")
|
var controllerKind = batchv1.SchemeGroupVersion.WithKind("CronJob")
|
||||||
|
|
||||||
// Controller is a controller for CronJobs.
|
// Controller is a controller for CronJobs.
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
@@ -129,11 +128,11 @@ func (jm *Controller) syncAll() {
|
|||||||
klog.V(4).Infof("Found %d groups", len(jobsByCj))
|
klog.V(4).Infof("Found %d groups", len(jobsByCj))
|
||||||
|
|
||||||
err = pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {
|
err = pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {
|
||||||
return jm.kubeClient.BatchV1beta1().CronJobs(metav1.NamespaceAll).List(ctx, opts)
|
return jm.kubeClient.BatchV1().CronJobs(metav1.NamespaceAll).List(ctx, opts)
|
||||||
}).EachListItem(context.Background(), metav1.ListOptions{}, func(object runtime.Object) error {
|
}).EachListItem(context.Background(), metav1.ListOptions{}, func(object runtime.Object) error {
|
||||||
cj, ok := object.(*batchv1beta1.CronJob)
|
cj, ok := object.(*batchv1.CronJob)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("expected type *batchv1beta1.CronJob, got type %T", cj)
|
return fmt.Errorf("expected type *batchv1.CronJob, got type %T", cj)
|
||||||
}
|
}
|
||||||
syncOne(cj, jobsByCj[cj.UID], time.Now(), jm.jobControl, jm.cjControl, jm.recorder)
|
syncOne(cj, jobsByCj[cj.UID], time.Now(), jm.jobControl, jm.cjControl, jm.recorder)
|
||||||
cleanupFinishedJobs(cj, jobsByCj[cj.UID], jm.jobControl, jm.cjControl, jm.recorder)
|
cleanupFinishedJobs(cj, jobsByCj[cj.UID], jm.jobControl, jm.cjControl, jm.recorder)
|
||||||
@@ -147,7 +146,7 @@ func (jm *Controller) syncAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cleanupFinishedJobs cleanups finished jobs created by a CronJob
|
// cleanupFinishedJobs cleanups finished jobs created by a CronJob
|
||||||
func cleanupFinishedJobs(cj *batchv1beta1.CronJob, js []batchv1.Job, jc jobControlInterface,
|
func cleanupFinishedJobs(cj *batchv1.CronJob, js []batchv1.Job, jc jobControlInterface,
|
||||||
cjc cjControlInterface, recorder record.EventRecorder) {
|
cjc cjControlInterface, recorder record.EventRecorder) {
|
||||||
// If neither limits are active, there is no need to do anything.
|
// If neither limits are active, there is no need to do anything.
|
||||||
if cj.Spec.FailedJobsHistoryLimit == nil && cj.Spec.SuccessfulJobsHistoryLimit == nil {
|
if cj.Spec.FailedJobsHistoryLimit == nil && cj.Spec.SuccessfulJobsHistoryLimit == nil {
|
||||||
@@ -190,7 +189,7 @@ func cleanupFinishedJobs(cj *batchv1beta1.CronJob, js []batchv1.Job, jc jobContr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// removeOldestJobs removes the oldest jobs from a list of jobs
|
// removeOldestJobs removes the oldest jobs from a list of jobs
|
||||||
func removeOldestJobs(cj *batchv1beta1.CronJob, js []batchv1.Job, jc jobControlInterface, maxJobs int32, recorder record.EventRecorder) {
|
func removeOldestJobs(cj *batchv1.CronJob, js []batchv1.Job, jc jobControlInterface, maxJobs int32, recorder record.EventRecorder) {
|
||||||
numToDelete := len(js) - int(maxJobs)
|
numToDelete := len(js) - int(maxJobs)
|
||||||
if numToDelete <= 0 {
|
if numToDelete <= 0 {
|
||||||
return
|
return
|
||||||
@@ -210,7 +209,7 @@ func removeOldestJobs(cj *batchv1beta1.CronJob, js []batchv1.Job, jc jobControlI
|
|||||||
// All known jobs created by "cj" should be included in "js".
|
// All known jobs created by "cj" should be included in "js".
|
||||||
// The current time is passed in to facilitate testing.
|
// The current time is passed in to facilitate testing.
|
||||||
// It has no receiver, to facilitate testing.
|
// It has no receiver, to facilitate testing.
|
||||||
func syncOne(cj *batchv1beta1.CronJob, js []batchv1.Job, now time.Time, jc jobControlInterface, cjc cjControlInterface, recorder record.EventRecorder) {
|
func syncOne(cj *batchv1.CronJob, js []batchv1.Job, now time.Time, jc jobControlInterface, cjc cjControlInterface, recorder record.EventRecorder) {
|
||||||
nameForLog := fmt.Sprintf("%s/%s", cj.Namespace, cj.Name)
|
nameForLog := fmt.Sprintf("%s/%s", cj.Namespace, cj.Name)
|
||||||
|
|
||||||
childrenJobs := make(map[types.UID]bool)
|
childrenJobs := make(map[types.UID]bool)
|
||||||
@@ -296,7 +295,7 @@ func syncOne(cj *batchv1beta1.CronJob, js []batchv1.Job, now time.Time, jc jobCo
|
|||||||
// can see easily that there was a missed execution.
|
// can see easily that there was a missed execution.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if cj.Spec.ConcurrencyPolicy == batchv1beta1.ForbidConcurrent && len(cj.Status.Active) > 0 {
|
if cj.Spec.ConcurrencyPolicy == batchv1.ForbidConcurrent && len(cj.Status.Active) > 0 {
|
||||||
// Regardless which source of information we use for the set of active jobs,
|
// Regardless which source of information we use for the set of active jobs,
|
||||||
// there is some risk that we won't see an active job when there is one.
|
// there is some risk that we won't see an active job when there is one.
|
||||||
// (because we haven't seen the status update to the SJ or the created pod).
|
// (because we haven't seen the status update to the SJ or the created pod).
|
||||||
@@ -309,7 +308,7 @@ func syncOne(cj *batchv1beta1.CronJob, js []batchv1.Job, now time.Time, jc jobCo
|
|||||||
klog.V(4).Infof("Not starting job for %s because of prior execution still running and concurrency policy is Forbid", nameForLog)
|
klog.V(4).Infof("Not starting job for %s because of prior execution still running and concurrency policy is Forbid", nameForLog)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if cj.Spec.ConcurrencyPolicy == batchv1beta1.ReplaceConcurrent {
|
if cj.Spec.ConcurrencyPolicy == batchv1.ReplaceConcurrent {
|
||||||
for _, j := range cj.Status.Active {
|
for _, j := range cj.Status.Active {
|
||||||
klog.V(4).Infof("Deleting job %s of %s that was still running at next scheduled start time", j.Name, nameForLog)
|
klog.V(4).Infof("Deleting job %s of %s that was still running at next scheduled start time", j.Name, nameForLog)
|
||||||
|
|
||||||
@@ -367,7 +366,7 @@ func syncOne(cj *batchv1beta1.CronJob, js []batchv1.Job, now time.Time, jc jobCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deleteJob reaps a job, deleting the job, the pods and the reference in the active list
|
// deleteJob reaps a job, deleting the job, the pods and the reference in the active list
|
||||||
func deleteJob(cj *batchv1beta1.CronJob, job *batchv1.Job, jc jobControlInterface, recorder record.EventRecorder) bool {
|
func deleteJob(cj *batchv1.CronJob, job *batchv1.Job, jc jobControlInterface, recorder record.EventRecorder) bool {
|
||||||
nameForLog := fmt.Sprintf("%s/%s", cj.Namespace, cj.Name)
|
nameForLog := fmt.Sprintf("%s/%s", cj.Namespace, cj.Name)
|
||||||
|
|
||||||
// delete the job itself...
|
// delete the job itself...
|
||||||
|
@@ -23,7 +23,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchV1beta1 "k8s.io/api/batch/v1beta1"
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@@ -106,19 +105,18 @@ func startTimeStringToTime(startTime string) time.Time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns a cronJob with some fields filled in.
|
// returns a cronJob with some fields filled in.
|
||||||
func cronJob() batchV1beta1.CronJob {
|
func cronJob() batchv1.CronJob {
|
||||||
return batchV1beta1.CronJob{
|
return batchv1.CronJob{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
Namespace: "snazzycats",
|
Namespace: "snazzycats",
|
||||||
UID: types.UID("1a2b3c"),
|
UID: types.UID("1a2b3c"),
|
||||||
SelfLink: "/apis/batch/v1beta1/namespaces/snazzycats/cronjobs/mycronjob",
|
|
||||||
CreationTimestamp: metav1.Time{Time: justBeforeTheHour()},
|
CreationTimestamp: metav1.Time{Time: justBeforeTheHour()},
|
||||||
},
|
},
|
||||||
Spec: batchV1beta1.CronJobSpec{
|
Spec: batchv1.CronJobSpec{
|
||||||
Schedule: "* * * * ?",
|
Schedule: "* * * * ?",
|
||||||
ConcurrencyPolicy: batchV1beta1.AllowConcurrent,
|
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||||
JobTemplate: batchV1beta1.JobTemplateSpec{
|
JobTemplate: batchv1.JobTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
Annotations: map[string]string{"x": "y"},
|
Annotations: map[string]string{"x": "y"},
|
||||||
@@ -155,7 +153,6 @@ func newJob(UID string) batchv1.Job {
|
|||||||
UID: types.UID(UID),
|
UID: types.UID(UID),
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
Namespace: metav1.NamespaceDefault,
|
Namespace: metav1.NamespaceDefault,
|
||||||
SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/myjob",
|
|
||||||
},
|
},
|
||||||
Spec: jobSpec(),
|
Spec: jobSpec(),
|
||||||
}
|
}
|
||||||
@@ -166,9 +163,9 @@ var (
|
|||||||
mediumDead int64 = 2 * 60 * 60
|
mediumDead int64 = 2 * 60 * 60
|
||||||
longDead int64 = 1000000
|
longDead int64 = 1000000
|
||||||
noDead int64 = -12345
|
noDead int64 = -12345
|
||||||
A = batchV1beta1.AllowConcurrent
|
A = batchv1.AllowConcurrent
|
||||||
f = batchV1beta1.ForbidConcurrent
|
f = batchv1.ForbidConcurrent
|
||||||
R = batchV1beta1.ReplaceConcurrent
|
R = batchv1.ReplaceConcurrent
|
||||||
T = true
|
T = true
|
||||||
F = false
|
F = false
|
||||||
)
|
)
|
||||||
@@ -189,7 +186,7 @@ func TestSyncOne_RunOrNot(t *testing.T) {
|
|||||||
|
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
// cj spec
|
// cj spec
|
||||||
concurrencyPolicy batchV1beta1.ConcurrencyPolicy
|
concurrencyPolicy batchv1.ConcurrencyPolicy
|
||||||
suspend bool
|
suspend bool
|
||||||
schedule string
|
schedule string
|
||||||
deadline int64
|
deadline int64
|
||||||
@@ -314,7 +311,7 @@ func TestSyncOne_RunOrNot(t *testing.T) {
|
|||||||
if controllerRef == nil {
|
if controllerRef == nil {
|
||||||
t.Errorf("%s: expected job to have ControllerRef: %#v", name, job)
|
t.Errorf("%s: expected job to have ControllerRef: %#v", name, job)
|
||||||
} else {
|
} else {
|
||||||
if got, want := controllerRef.APIVersion, "batch/v1beta1"; got != want {
|
if got, want := controllerRef.APIVersion, "batch/v1"; got != want {
|
||||||
t.Errorf("%s: controllerRef.APIVersion = %q, want %q", name, got, want)
|
t.Errorf("%s: controllerRef.APIVersion = %q, want %q", name, got, want)
|
||||||
}
|
}
|
||||||
if got, want := controllerRef.Kind, "CronJob"; got != want {
|
if got, want := controllerRef.Kind, "CronJob"; got != want {
|
||||||
@@ -617,7 +614,7 @@ func TestSyncOne_Status(t *testing.T) {
|
|||||||
|
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
// cj spec
|
// cj spec
|
||||||
concurrencyPolicy batchV1beta1.ConcurrencyPolicy
|
concurrencyPolicy batchv1.ConcurrencyPolicy
|
||||||
suspend bool
|
suspend bool
|
||||||
schedule string
|
schedule string
|
||||||
deadline int64
|
deadline int64
|
||||||
|
@@ -25,7 +25,6 @@ import (
|
|||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@@ -34,12 +33,10 @@ import (
|
|||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
batchv1informers "k8s.io/client-go/informers/batch/v1"
|
batchv1informers "k8s.io/client-go/informers/batch/v1"
|
||||||
batchv1beta1informers "k8s.io/client-go/informers/batch/v1beta1"
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/kubernetes/scheme"
|
"k8s.io/client-go/kubernetes/scheme"
|
||||||
covev1client "k8s.io/client-go/kubernetes/typed/core/v1"
|
covev1client "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
batchv1listers "k8s.io/client-go/listers/batch/v1"
|
batchv1listers "k8s.io/client-go/listers/batch/v1"
|
||||||
batchv1beta1listers "k8s.io/client-go/listers/batch/v1beta1"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
"k8s.io/client-go/util/workqueue"
|
"k8s.io/client-go/util/workqueue"
|
||||||
@@ -63,7 +60,7 @@ type ControllerV2 struct {
|
|||||||
cronJobControl cjControlInterface
|
cronJobControl cjControlInterface
|
||||||
|
|
||||||
jobLister batchv1listers.JobLister
|
jobLister batchv1listers.JobLister
|
||||||
cronJobLister batchv1beta1listers.CronJobLister
|
cronJobLister batchv1listers.CronJobLister
|
||||||
|
|
||||||
jobListerSynced cache.InformerSynced
|
jobListerSynced cache.InformerSynced
|
||||||
cronJobListerSynced cache.InformerSynced
|
cronJobListerSynced cache.InformerSynced
|
||||||
@@ -73,7 +70,7 @@ type ControllerV2 struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewControllerV2 creates and initializes a new Controller.
|
// NewControllerV2 creates and initializes a new Controller.
|
||||||
func NewControllerV2(jobInformer batchv1informers.JobInformer, cronJobsInformer batchv1beta1informers.CronJobInformer, kubeClient clientset.Interface) (*ControllerV2, error) {
|
func NewControllerV2(jobInformer batchv1informers.JobInformer, cronJobsInformer batchv1informers.CronJobInformer, kubeClient clientset.Interface) (*ControllerV2, error) {
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
eventBroadcaster := record.NewBroadcaster()
|
||||||
eventBroadcaster.StartStructuredLogging(0)
|
eventBroadcaster.StartStructuredLogging(0)
|
||||||
eventBroadcaster.StartRecordingToSink(&covev1client.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
eventBroadcaster.StartRecordingToSink(&covev1client.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
||||||
@@ -208,7 +205,7 @@ func (jm *ControllerV2) sync(cronJobKey string) (*time.Duration, error) {
|
|||||||
// resolveControllerRef returns the controller referenced by a ControllerRef,
|
// resolveControllerRef returns the controller referenced by a ControllerRef,
|
||||||
// or nil if the ControllerRef could not be resolved to a matching controller
|
// or nil if the ControllerRef could not be resolved to a matching controller
|
||||||
// of the correct Kind.
|
// of the correct Kind.
|
||||||
func (jm *ControllerV2) resolveControllerRef(namespace string, controllerRef *metav1.OwnerReference) *batchv1beta1.CronJob {
|
func (jm *ControllerV2) resolveControllerRef(namespace string, controllerRef *metav1.OwnerReference) *batchv1.CronJob {
|
||||||
// We can't look up by UID, so look up by Name and then verify UID.
|
// We can't look up by UID, so look up by Name and then verify UID.
|
||||||
// Don't even try to look up by Name if it's the wrong Kind.
|
// Don't even try to look up by Name if it's the wrong Kind.
|
||||||
if controllerRef.Kind != controllerKind.Kind {
|
if controllerRef.Kind != controllerKind.Kind {
|
||||||
@@ -226,7 +223,7 @@ func (jm *ControllerV2) resolveControllerRef(namespace string, controllerRef *me
|
|||||||
return cronJob
|
return cronJob
|
||||||
}
|
}
|
||||||
|
|
||||||
func (jm *ControllerV2) getJobsToBeReconciled(cronJob *batchv1beta1.CronJob) ([]*batchv1.Job, error) {
|
func (jm *ControllerV2) getJobsToBeReconciled(cronJob *batchv1.CronJob) ([]*batchv1.Job, error) {
|
||||||
var jobSelector labels.Selector
|
var jobSelector labels.Selector
|
||||||
if len(cronJob.Spec.JobTemplate.Labels) == 0 {
|
if len(cronJob.Spec.JobTemplate.Labels) == 0 {
|
||||||
jobSelector = labels.Everything()
|
jobSelector = labels.Everything()
|
||||||
@@ -359,8 +356,8 @@ func (jm *ControllerV2) enqueueControllerAfter(obj interface{}, t time.Duration)
|
|||||||
// updateCronJob re-queues the CronJob for next scheduled time if there is a
|
// updateCronJob re-queues the CronJob for next scheduled time if there is a
|
||||||
// change in spec.schedule otherwise it re-queues it now
|
// change in spec.schedule otherwise it re-queues it now
|
||||||
func (jm *ControllerV2) updateCronJob(old interface{}, curr interface{}) {
|
func (jm *ControllerV2) updateCronJob(old interface{}, curr interface{}) {
|
||||||
oldCJ, okOld := old.(*batchv1beta1.CronJob)
|
oldCJ, okOld := old.(*batchv1.CronJob)
|
||||||
newCJ, okNew := curr.(*batchv1beta1.CronJob)
|
newCJ, okNew := curr.(*batchv1.CronJob)
|
||||||
|
|
||||||
if !okOld || !okNew {
|
if !okOld || !okNew {
|
||||||
// typecasting of one failed, handle this better, may be log entry
|
// typecasting of one failed, handle this better, may be log entry
|
||||||
@@ -400,8 +397,8 @@ func (jm *ControllerV2) updateCronJob(old interface{}, curr interface{}) {
|
|||||||
// It returns a copy of the CronJob that is to be used by other functions
|
// It returns a copy of the CronJob that is to be used by other functions
|
||||||
// that mutates the object
|
// that mutates the object
|
||||||
func (jm *ControllerV2) syncCronJob(
|
func (jm *ControllerV2) syncCronJob(
|
||||||
cj *batchv1beta1.CronJob,
|
cj *batchv1.CronJob,
|
||||||
js []*batchv1.Job) (*batchv1beta1.CronJob, *time.Duration, error) {
|
js []*batchv1.Job) (*batchv1.CronJob, *time.Duration, error) {
|
||||||
|
|
||||||
cj = cj.DeepCopy()
|
cj = cj.DeepCopy()
|
||||||
now := jm.now()
|
now := jm.now()
|
||||||
@@ -525,7 +522,7 @@ func (jm *ControllerV2) syncCronJob(
|
|||||||
t := nextScheduledTimeDuration(sched, now)
|
t := nextScheduledTimeDuration(sched, now)
|
||||||
return cj, t, nil
|
return cj, t, nil
|
||||||
}
|
}
|
||||||
if cj.Spec.ConcurrencyPolicy == batchv1beta1.ForbidConcurrent && len(cj.Status.Active) > 0 {
|
if cj.Spec.ConcurrencyPolicy == batchv1.ForbidConcurrent && len(cj.Status.Active) > 0 {
|
||||||
// Regardless which source of information we use for the set of active jobs,
|
// Regardless which source of information we use for the set of active jobs,
|
||||||
// there is some risk that we won't see an active job when there is one.
|
// there is some risk that we won't see an active job when there is one.
|
||||||
// (because we haven't seen the status update to the SJ or the created pod).
|
// (because we haven't seen the status update to the SJ or the created pod).
|
||||||
@@ -540,7 +537,7 @@ func (jm *ControllerV2) syncCronJob(
|
|||||||
t := nextScheduledTimeDuration(sched, now)
|
t := nextScheduledTimeDuration(sched, now)
|
||||||
return cj, t, nil
|
return cj, t, nil
|
||||||
}
|
}
|
||||||
if cj.Spec.ConcurrencyPolicy == batchv1beta1.ReplaceConcurrent {
|
if cj.Spec.ConcurrencyPolicy == batchv1.ReplaceConcurrent {
|
||||||
for _, j := range cj.Status.Active {
|
for _, j := range cj.Status.Active {
|
||||||
klog.V(4).InfoS("Deleting job that was still running at next scheduled start time", "job", klog.KRef(j.Namespace, j.Name))
|
klog.V(4).InfoS("Deleting job that was still running at next scheduled start time", "job", klog.KRef(j.Namespace, j.Name))
|
||||||
|
|
||||||
@@ -604,7 +601,7 @@ func (jm *ControllerV2) syncCronJob(
|
|||||||
return cj, t, nil
|
return cj, t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getJobName(cj *batchv1beta1.CronJob, scheduledTime time.Time) string {
|
func getJobName(cj *batchv1.CronJob, scheduledTime time.Time) string {
|
||||||
return fmt.Sprintf("%s-%d", cj.Name, getTimeHashInMinutes(scheduledTime))
|
return fmt.Sprintf("%s-%d", cj.Name, getTimeHashInMinutes(scheduledTime))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,7 +616,7 @@ func nextScheduledTimeDuration(sched cron.Schedule, now time.Time) *time.Duratio
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cleanupFinishedJobs cleanups finished jobs created by a CronJob
|
// cleanupFinishedJobs cleanups finished jobs created by a CronJob
|
||||||
func (jm *ControllerV2) cleanupFinishedJobs(cj *batchv1beta1.CronJob, js []*batchv1.Job) error {
|
func (jm *ControllerV2) cleanupFinishedJobs(cj *batchv1.CronJob, js []*batchv1.Job) error {
|
||||||
// If neither limits are active, there is no need to do anything.
|
// If neither limits are active, there is no need to do anything.
|
||||||
if cj.Spec.FailedJobsHistoryLimit == nil && cj.Spec.SuccessfulJobsHistoryLimit == nil {
|
if cj.Spec.FailedJobsHistoryLimit == nil && cj.Spec.SuccessfulJobsHistoryLimit == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -664,7 +661,7 @@ func (jm *ControllerV2) getFinishedStatus(j *batchv1.Job) (bool, batchv1.JobCond
|
|||||||
}
|
}
|
||||||
|
|
||||||
// removeOldestJobs removes the oldest jobs from a list of jobs
|
// removeOldestJobs removes the oldest jobs from a list of jobs
|
||||||
func (jm *ControllerV2) removeOldestJobs(cj *batchv1beta1.CronJob, js []*batchv1.Job, maxJobs int32) {
|
func (jm *ControllerV2) removeOldestJobs(cj *batchv1.CronJob, js []*batchv1.Job, maxJobs int32) {
|
||||||
numToDelete := len(js) - int(maxJobs)
|
numToDelete := len(js) - int(maxJobs)
|
||||||
if numToDelete <= 0 {
|
if numToDelete <= 0 {
|
||||||
return
|
return
|
||||||
|
@@ -24,9 +24,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
"k8s.io/api/core/v1"
|
||||||
v1 "k8s.io/api/core/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
@@ -62,7 +62,7 @@ func Test_syncCronJob(t *testing.T) {
|
|||||||
|
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
// cj spec
|
// cj spec
|
||||||
concurrencyPolicy batchv1beta1.ConcurrencyPolicy
|
concurrencyPolicy batchv1.ConcurrencyPolicy
|
||||||
suspend bool
|
suspend bool
|
||||||
schedule string
|
schedule string
|
||||||
deadline int64
|
deadline int64
|
||||||
@@ -241,7 +241,7 @@ func Test_syncCronJob(t *testing.T) {
|
|||||||
if controllerRef == nil {
|
if controllerRef == nil {
|
||||||
t.Errorf("%s: expected job to have ControllerRef: %#v", name, job)
|
t.Errorf("%s: expected job to have ControllerRef: %#v", name, job)
|
||||||
} else {
|
} else {
|
||||||
if got, want := controllerRef.APIVersion, "batch/v1beta1"; got != want {
|
if got, want := controllerRef.APIVersion, "batch/v1"; got != want {
|
||||||
t.Errorf("%s: controllerRef.APIVersion = %q, want %q", name, got, want)
|
t.Errorf("%s: controllerRef.APIVersion = %q, want %q", name, got, want)
|
||||||
}
|
}
|
||||||
if got, want := controllerRef.Kind, "CronJob"; got != want {
|
if got, want := controllerRef.Kind, "CronJob"; got != want {
|
||||||
@@ -332,8 +332,8 @@ func TestController2_updateCronJob(t *testing.T) {
|
|||||||
cronJobControl cjControlInterface
|
cronJobControl cjControlInterface
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
oldJobTemplate *batchv1beta1.JobTemplateSpec
|
oldJobTemplate *batchv1.JobTemplateSpec
|
||||||
newJobTemplate *batchv1beta1.JobTemplateSpec
|
newJobTemplate *batchv1.JobTemplateSpec
|
||||||
oldJobSchedule string
|
oldJobSchedule string
|
||||||
newJobSchedule string
|
newJobSchedule string
|
||||||
}
|
}
|
||||||
@@ -352,14 +352,14 @@ func TestController2_updateCronJob(t *testing.T) {
|
|||||||
cronJobControl: cjc,
|
cronJobControl: cjc,
|
||||||
},
|
},
|
||||||
args: args{
|
args: args{
|
||||||
oldJobTemplate: &batchv1beta1.JobTemplateSpec{
|
oldJobTemplate: &batchv1.JobTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
Annotations: map[string]string{"x": "y"},
|
Annotations: map[string]string{"x": "y"},
|
||||||
},
|
},
|
||||||
Spec: jobSpec(),
|
Spec: jobSpec(),
|
||||||
},
|
},
|
||||||
newJobTemplate: &batchv1beta1.JobTemplateSpec{
|
newJobTemplate: &batchv1.JobTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "foo"},
|
Labels: map[string]string{"a": "foo"},
|
||||||
Annotations: map[string]string{"x": "y"},
|
Annotations: map[string]string{"x": "y"},
|
||||||
@@ -459,7 +459,7 @@ func TestControllerV2_getJobList(t *testing.T) {
|
|||||||
jobLister batchv1listers.JobLister
|
jobLister batchv1listers.JobLister
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
cronJob *batchv1beta1.CronJob
|
cronJob *batchv1.CronJob
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -482,7 +482,7 @@ func TestControllerV2_getJobList(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "foo-ns"},
|
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "foo-ns"},
|
||||||
},
|
},
|
||||||
}}},
|
}}},
|
||||||
args: args{cronJob: &batchv1beta1.CronJob{ObjectMeta: metav1.ObjectMeta{Namespace: "foo-ns", Name: "fooer"}}},
|
args: args{cronJob: &batchv1.CronJob{ObjectMeta: metav1.ObjectMeta{Namespace: "foo-ns", Name: "fooer"}}},
|
||||||
want: []*batchv1.Job{},
|
want: []*batchv1.Job{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -505,7 +505,7 @@ func TestControllerV2_getJobList(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "foo-ns"},
|
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "foo-ns"},
|
||||||
},
|
},
|
||||||
}}},
|
}}},
|
||||||
args: args{cronJob: &batchv1beta1.CronJob{ObjectMeta: metav1.ObjectMeta{Namespace: "foo-ns", Name: "fooer"}}},
|
args: args{cronJob: &batchv1.CronJob{ObjectMeta: metav1.ObjectMeta{Namespace: "foo-ns", Name: "fooer"}}},
|
||||||
want: []*batchv1.Job{{
|
want: []*batchv1.Job{{
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "foo1", Namespace: "foo-ns",
|
ObjectMeta: metav1.ObjectMeta{Name: "foo1", Namespace: "foo-ns",
|
||||||
OwnerReferences: []metav1.OwnerReference{
|
OwnerReferences: []metav1.OwnerReference{
|
||||||
@@ -530,7 +530,7 @@ func TestControllerV2_getJobList(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "bar-ns"},
|
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "bar-ns"},
|
||||||
},
|
},
|
||||||
}}},
|
}}},
|
||||||
args: args{cronJob: &batchv1beta1.CronJob{ObjectMeta: metav1.ObjectMeta{Namespace: "foo-ns", Name: "fooer"}}},
|
args: args{cronJob: &batchv1.CronJob{ObjectMeta: metav1.ObjectMeta{Namespace: "foo-ns", Name: "fooer"}}},
|
||||||
want: []*batchv1.Job{},
|
want: []*batchv1.Job{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -19,15 +19,14 @@ package cronjob
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
@@ -36,9 +35,9 @@ import (
|
|||||||
// cjControlInterface is an interface that knows how to update CronJob status
|
// cjControlInterface is an interface that knows how to update CronJob status
|
||||||
// created as an interface to allow testing.
|
// created as an interface to allow testing.
|
||||||
type cjControlInterface interface {
|
type cjControlInterface interface {
|
||||||
UpdateStatus(cj *batchv1beta1.CronJob) (*batchv1beta1.CronJob, error)
|
UpdateStatus(cj *batchv1.CronJob) (*batchv1.CronJob, error)
|
||||||
// GetCronJob retrieves a CronJob.
|
// GetCronJob retrieves a CronJob.
|
||||||
GetCronJob(namespace, name string) (*batchv1beta1.CronJob, error)
|
GetCronJob(namespace, name string) (*batchv1.CronJob, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// realCJControl is the default implementation of cjControlInterface.
|
// realCJControl is the default implementation of cjControlInterface.
|
||||||
@@ -46,23 +45,23 @@ type realCJControl struct {
|
|||||||
KubeClient clientset.Interface
|
KubeClient clientset.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *realCJControl) GetCronJob(namespace, name string) (*batchv1beta1.CronJob, error) {
|
func (c *realCJControl) GetCronJob(namespace, name string) (*batchv1.CronJob, error) {
|
||||||
return c.KubeClient.BatchV1beta1().CronJobs(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
return c.KubeClient.BatchV1().CronJobs(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ cjControlInterface = &realCJControl{}
|
var _ cjControlInterface = &realCJControl{}
|
||||||
|
|
||||||
func (c *realCJControl) UpdateStatus(cj *batchv1beta1.CronJob) (*batchv1beta1.CronJob, error) {
|
func (c *realCJControl) UpdateStatus(cj *batchv1.CronJob) (*batchv1.CronJob, error) {
|
||||||
return c.KubeClient.BatchV1beta1().CronJobs(cj.Namespace).UpdateStatus(context.TODO(), cj, metav1.UpdateOptions{})
|
return c.KubeClient.BatchV1().CronJobs(cj.Namespace).UpdateStatus(context.TODO(), cj, metav1.UpdateOptions{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// fakeCJControl is the default implementation of cjControlInterface.
|
// fakeCJControl is the default implementation of cjControlInterface.
|
||||||
type fakeCJControl struct {
|
type fakeCJControl struct {
|
||||||
CronJob *batchv1beta1.CronJob
|
CronJob *batchv1.CronJob
|
||||||
Updates []batchv1beta1.CronJob
|
Updates []batchv1.CronJob
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *fakeCJControl) GetCronJob(namespace, name string) (*batchv1beta1.CronJob, error) {
|
func (c *fakeCJControl) GetCronJob(namespace, name string) (*batchv1.CronJob, error) {
|
||||||
if name == c.CronJob.Name && namespace == c.CronJob.Namespace {
|
if name == c.CronJob.Name && namespace == c.CronJob.Namespace {
|
||||||
return c.CronJob, nil
|
return c.CronJob, nil
|
||||||
}
|
}
|
||||||
@@ -74,7 +73,7 @@ func (c *fakeCJControl) GetCronJob(namespace, name string) (*batchv1beta1.CronJo
|
|||||||
|
|
||||||
var _ cjControlInterface = &fakeCJControl{}
|
var _ cjControlInterface = &fakeCJControl{}
|
||||||
|
|
||||||
func (c *fakeCJControl) UpdateStatus(cj *batchv1beta1.CronJob) (*batchv1beta1.CronJob, error) {
|
func (c *fakeCJControl) UpdateStatus(cj *batchv1.CronJob) (*batchv1.CronJob, error) {
|
||||||
c.Updates = append(c.Updates, *cj)
|
c.Updates = append(c.Updates, *cj)
|
||||||
return cj, nil
|
return cj, nil
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ type realJobControl struct {
|
|||||||
|
|
||||||
var _ jobControlInterface = &realJobControl{}
|
var _ jobControlInterface = &realJobControl{}
|
||||||
|
|
||||||
func copyLabels(template *batchv1beta1.JobTemplateSpec) labels.Set {
|
func copyLabels(template *batchv1.JobTemplateSpec) labels.Set {
|
||||||
l := make(labels.Set)
|
l := make(labels.Set)
|
||||||
for k, v := range template.Labels {
|
for k, v := range template.Labels {
|
||||||
l[k] = v
|
l[k] = v
|
||||||
@@ -113,7 +112,7 @@ func copyLabels(template *batchv1beta1.JobTemplateSpec) labels.Set {
|
|||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyAnnotations(template *batchv1beta1.JobTemplateSpec) labels.Set {
|
func copyAnnotations(template *batchv1.JobTemplateSpec) labels.Set {
|
||||||
a := make(labels.Set)
|
a := make(labels.Set)
|
||||||
for k, v := range template.Annotations {
|
for k, v := range template.Annotations {
|
||||||
a[k] = v
|
a[k] = v
|
||||||
|
@@ -24,7 +24,6 @@ import (
|
|||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@@ -33,7 +32,7 @@ import (
|
|||||||
|
|
||||||
// Utilities for dealing with Jobs and CronJobs and time.
|
// Utilities for dealing with Jobs and CronJobs and time.
|
||||||
|
|
||||||
func inActiveList(cj batchv1beta1.CronJob, uid types.UID) bool {
|
func inActiveList(cj batchv1.CronJob, uid types.UID) bool {
|
||||||
for _, j := range cj.Status.Active {
|
for _, j := range cj.Status.Active {
|
||||||
if j.UID == uid {
|
if j.UID == uid {
|
||||||
return true
|
return true
|
||||||
@@ -42,7 +41,7 @@ func inActiveList(cj batchv1beta1.CronJob, uid types.UID) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteFromActiveList(cj *batchv1beta1.CronJob, uid types.UID) {
|
func deleteFromActiveList(cj *batchv1.CronJob, uid types.UID) {
|
||||||
if cj == nil {
|
if cj == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -92,7 +91,7 @@ func groupJobsByParent(js []batchv1.Job) map[types.UID][]batchv1.Job {
|
|||||||
//
|
//
|
||||||
// If there are too many (>100) unstarted times, just give up and return an empty slice.
|
// If there are too many (>100) unstarted times, just give up and return an empty slice.
|
||||||
// If there were missed times prior to the last known start time, then those are not returned.
|
// If there were missed times prior to the last known start time, then those are not returned.
|
||||||
func getRecentUnmetScheduleTimes(cj batchv1beta1.CronJob, now time.Time) ([]time.Time, error) {
|
func getRecentUnmetScheduleTimes(cj batchv1.CronJob, now time.Time) ([]time.Time, error) {
|
||||||
starts := []time.Time{}
|
starts := []time.Time{}
|
||||||
sched, err := cron.ParseStandard(cj.Spec.Schedule)
|
sched, err := cron.ParseStandard(cj.Spec.Schedule)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -154,7 +153,7 @@ func getRecentUnmetScheduleTimes(cj batchv1beta1.CronJob, now time.Time) ([]time
|
|||||||
// it returns nil if no unmet schedule times.
|
// it returns nil if no unmet schedule times.
|
||||||
// If there are too many (>100) unstarted times, it will raise a warning and but still return
|
// If there are too many (>100) unstarted times, it will raise a warning and but still return
|
||||||
// the list of missed times.
|
// the list of missed times.
|
||||||
func getNextScheduleTime(cj batchv1beta1.CronJob, now time.Time, schedule cron.Schedule, recorder record.EventRecorder) (*time.Time, error) {
|
func getNextScheduleTime(cj batchv1.CronJob, now time.Time, schedule cron.Schedule, recorder record.EventRecorder) (*time.Time, error) {
|
||||||
starts := []time.Time{}
|
starts := []time.Time{}
|
||||||
|
|
||||||
var earliestTime time.Time
|
var earliestTime time.Time
|
||||||
@@ -234,7 +233,7 @@ func getMostRecentScheduleTime(earliestTime time.Time, now time.Time, schedule c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getJobFromTemplate makes a Job from a CronJob
|
// getJobFromTemplate makes a Job from a CronJob
|
||||||
func getJobFromTemplate(cj *batchv1beta1.CronJob, scheduledTime time.Time) (*batchv1.Job, error) {
|
func getJobFromTemplate(cj *batchv1.CronJob, scheduledTime time.Time) (*batchv1.Job, error) {
|
||||||
labels := copyLabels(&cj.Spec.JobTemplate)
|
labels := copyLabels(&cj.Spec.JobTemplate)
|
||||||
annotations := copyAnnotations(&cj.Spec.JobTemplate)
|
annotations := copyAnnotations(&cj.Spec.JobTemplate)
|
||||||
// We want job names for a given nominal start time to have a deterministic name to avoid the same job being created twice
|
// We want job names for a given nominal start time to have a deterministic name to avoid the same job being created twice
|
||||||
@@ -260,7 +259,7 @@ func getTimeHash(scheduledTime time.Time) int64 {
|
|||||||
// getJobFromTemplate2 makes a Job from a CronJob. It converts the unix time into minutes from
|
// getJobFromTemplate2 makes a Job from a CronJob. It converts the unix time into minutes from
|
||||||
// epoch time and concatenates that to the job name, because the cronjob_controller v2 has the lowest
|
// epoch time and concatenates that to the job name, because the cronjob_controller v2 has the lowest
|
||||||
// granularity of 1 minute for scheduling job.
|
// granularity of 1 minute for scheduling job.
|
||||||
func getJobFromTemplate2(cj *batchv1beta1.CronJob, scheduledTime time.Time) (*batchv1.Job, error) {
|
func getJobFromTemplate2(cj *batchv1.CronJob, scheduledTime time.Time) (*batchv1.Job, error) {
|
||||||
labels := copyLabels(&cj.Spec.JobTemplate)
|
labels := copyLabels(&cj.Spec.JobTemplate)
|
||||||
annotations := copyAnnotations(&cj.Spec.JobTemplate)
|
annotations := copyAnnotations(&cj.Spec.JobTemplate)
|
||||||
// We want job names for a given nominal start time to have a deterministic name to avoid the same job being created twice
|
// We want job names for a given nominal start time to have a deterministic name to avoid the same job being created twice
|
||||||
|
@@ -25,7 +25,6 @@ import (
|
|||||||
|
|
||||||
cron "github.com/robfig/cron"
|
cron "github.com/robfig/cron"
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@@ -40,17 +39,17 @@ func TestGetJobFromTemplate(t *testing.T) {
|
|||||||
var one int64 = 1
|
var one int64 = 1
|
||||||
var no bool
|
var no bool
|
||||||
|
|
||||||
cj := batchv1beta1.CronJob{
|
cj := batchv1.CronJob{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
Namespace: "snazzycats",
|
Namespace: "snazzycats",
|
||||||
UID: types.UID("1a2b3c"),
|
UID: types.UID("1a2b3c"),
|
||||||
SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/mycronjob",
|
SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/mycronjob",
|
||||||
},
|
},
|
||||||
Spec: batchv1beta1.CronJobSpec{
|
Spec: batchv1.CronJobSpec{
|
||||||
Schedule: "* * * * ?",
|
Schedule: "* * * * ?",
|
||||||
ConcurrencyPolicy: batchv1beta1.AllowConcurrent,
|
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||||
JobTemplate: batchv1beta1.JobTemplateSpec{
|
JobTemplate: batchv1.JobTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
Annotations: map[string]string{"x": "y"},
|
Annotations: map[string]string{"x": "y"},
|
||||||
@@ -98,17 +97,17 @@ func TestGetJobFromTemplate2(t *testing.T) {
|
|||||||
var one int64 = 1
|
var one int64 = 1
|
||||||
var no bool
|
var no bool
|
||||||
|
|
||||||
cj := batchv1beta1.CronJob{
|
cj := batchv1.CronJob{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
Namespace: "snazzycats",
|
Namespace: "snazzycats",
|
||||||
UID: types.UID("1a2b3c"),
|
UID: types.UID("1a2b3c"),
|
||||||
SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/mycronjob",
|
SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/mycronjob",
|
||||||
},
|
},
|
||||||
Spec: batchv1beta1.CronJobSpec{
|
Spec: batchv1.CronJobSpec{
|
||||||
Schedule: "* * * * ?",
|
Schedule: "* * * * ?",
|
||||||
ConcurrencyPolicy: batchv1beta1.AllowConcurrent,
|
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||||
JobTemplate: batchv1beta1.JobTemplateSpec{
|
JobTemplate: batchv1.JobTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
Annotations: map[string]string{"x": "y"},
|
Annotations: map[string]string{"x": "y"},
|
||||||
@@ -326,16 +325,16 @@ func TestGetNextScheduleTime(t *testing.T) {
|
|||||||
t.Errorf("test setup error: %v", err)
|
t.Errorf("test setup error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cj := batchv1beta1.CronJob{
|
cj := batchv1.CronJob{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
Namespace: metav1.NamespaceDefault,
|
Namespace: metav1.NamespaceDefault,
|
||||||
UID: types.UID("1a2b3c"),
|
UID: types.UID("1a2b3c"),
|
||||||
},
|
},
|
||||||
Spec: batchv1beta1.CronJobSpec{
|
Spec: batchv1.CronJobSpec{
|
||||||
Schedule: schedule,
|
Schedule: schedule,
|
||||||
ConcurrencyPolicy: batchv1beta1.AllowConcurrent,
|
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||||
JobTemplate: batchv1beta1.JobTemplateSpec{},
|
JobTemplate: batchv1.JobTemplateSpec{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -442,16 +441,16 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) {
|
|||||||
t.Errorf("test setup error: %v", err)
|
t.Errorf("test setup error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cj := batchv1beta1.CronJob{
|
cj := batchv1.CronJob{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
Namespace: metav1.NamespaceDefault,
|
Namespace: metav1.NamespaceDefault,
|
||||||
UID: types.UID("1a2b3c"),
|
UID: types.UID("1a2b3c"),
|
||||||
},
|
},
|
||||||
Spec: batchv1beta1.CronJobSpec{
|
Spec: batchv1.CronJobSpec{
|
||||||
Schedule: schedule,
|
Schedule: schedule,
|
||||||
ConcurrencyPolicy: batchv1beta1.AllowConcurrent,
|
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||||
JobTemplate: batchv1beta1.JobTemplateSpec{},
|
JobTemplate: batchv1.JobTemplateSpec{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@@ -61,6 +61,7 @@ var GVRToStorageVersionHash = map[string]string{
|
|||||||
"autoscaling/v2beta1/horizontalpodautoscalers": "oQlkt7f5j/A=",
|
"autoscaling/v2beta1/horizontalpodautoscalers": "oQlkt7f5j/A=",
|
||||||
"autoscaling/v2beta2/horizontalpodautoscalers": "oQlkt7f5j/A=",
|
"autoscaling/v2beta2/horizontalpodautoscalers": "oQlkt7f5j/A=",
|
||||||
"batch/v1/jobs": "mudhfqk/qZY=",
|
"batch/v1/jobs": "mudhfqk/qZY=",
|
||||||
|
"batch/v1/cronjobs": "h/JlFAZkyyY=",
|
||||||
"batch/v1beta1/cronjobs": "h/JlFAZkyyY=",
|
"batch/v1beta1/cronjobs": "h/JlFAZkyyY=",
|
||||||
"certificates.k8s.io/v1/certificatesigningrequests": "95fRKMXA+00=",
|
"certificates.k8s.io/v1/certificatesigningrequests": "95fRKMXA+00=",
|
||||||
"certificates.k8s.io/v1beta1/certificatesigningrequests": "95fRKMXA+00=",
|
"certificates.k8s.io/v1beta1/certificatesigningrequests": "95fRKMXA+00=",
|
||||||
|
@@ -64,6 +64,14 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
|||||||
storage["jobs"] = jobsStorage
|
storage["jobs"] = jobsStorage
|
||||||
storage["jobs/status"] = jobsStatusStorage
|
storage["jobs/status"] = jobsStatusStorage
|
||||||
|
|
||||||
|
// cronjobs
|
||||||
|
cronJobsStorage, cronJobsStatusStorage, err := cronjobstore.NewREST(restOptionsGetter)
|
||||||
|
if err != nil {
|
||||||
|
return storage, err
|
||||||
|
}
|
||||||
|
storage["cronjobs"] = cronJobsStorage
|
||||||
|
storage["cronjobs/status"] = cronJobsStatusStorage
|
||||||
|
|
||||||
return storage, err
|
return storage, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1507
staging/src/k8s.io/api/batch/v1/generated.pb.go
generated
1507
staging/src/k8s.io/api/batch/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,88 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
|||||||
// Package-wide variables from generator "generated".
|
// Package-wide variables from generator "generated".
|
||||||
option go_package = "v1";
|
option go_package = "v1";
|
||||||
|
|
||||||
|
// CronJob represents the configuration of a single cron job.
|
||||||
|
message CronJob {
|
||||||
|
// Standard object's metadata.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||||
|
|
||||||
|
// Specification of the desired behavior of a cron job, including the schedule.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
// +optional
|
||||||
|
optional CronJobSpec spec = 2;
|
||||||
|
|
||||||
|
// Current status of a cron job.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
// +optional
|
||||||
|
optional CronJobStatus status = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobList is a collection of cron jobs.
|
||||||
|
message CronJobList {
|
||||||
|
// Standard list metadata.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||||
|
|
||||||
|
// items is the list of CronJobs.
|
||||||
|
repeated CronJob items = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobSpec describes how the job execution will look like and when it will actually run.
|
||||||
|
message CronJobSpec {
|
||||||
|
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
|
||||||
|
optional string schedule = 1;
|
||||||
|
|
||||||
|
// Optional deadline in seconds for starting the job if it misses scheduled
|
||||||
|
// time for any reason. Missed jobs executions will be counted as failed ones.
|
||||||
|
// +optional
|
||||||
|
optional int64 startingDeadlineSeconds = 2;
|
||||||
|
|
||||||
|
// Specifies how to treat concurrent executions of a Job.
|
||||||
|
// Valid values are:
|
||||||
|
// - "Allow" (default): allows CronJobs 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
|
||||||
|
optional string concurrencyPolicy = 3;
|
||||||
|
|
||||||
|
// This flag tells the controller to suspend subsequent executions, it does
|
||||||
|
// not apply to already started executions. Defaults to false.
|
||||||
|
// +optional
|
||||||
|
optional bool suspend = 4;
|
||||||
|
|
||||||
|
// Specifies the job that will be created when executing a CronJob.
|
||||||
|
optional JobTemplateSpec jobTemplate = 5;
|
||||||
|
|
||||||
|
// The number of successful finished jobs to retain. Value must be non-negative integer.
|
||||||
|
// Defaults to 3.
|
||||||
|
// +optional
|
||||||
|
optional int32 successfulJobsHistoryLimit = 6;
|
||||||
|
|
||||||
|
// The number of failed finished jobs to retain. Value must be non-negative integer.
|
||||||
|
// Defaults to 1.
|
||||||
|
// +optional
|
||||||
|
optional int32 failedJobsHistoryLimit = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobStatus represents the current state of a cron job.
|
||||||
|
message CronJobStatus {
|
||||||
|
// A list of pointers to currently running jobs.
|
||||||
|
// +optional
|
||||||
|
// +listType=atomic
|
||||||
|
repeated k8s.io.api.core.v1.ObjectReference active = 1;
|
||||||
|
|
||||||
|
// Information when was the last time the job was successfully scheduled.
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScheduleTime = 4;
|
||||||
|
|
||||||
|
// Information when was the last time the job successfully completed.
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSuccessfulTime = 5;
|
||||||
|
}
|
||||||
|
|
||||||
// Job represents the configuration of a single job.
|
// Job represents the configuration of a single job.
|
||||||
message Job {
|
message Job {
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
@@ -178,6 +260,7 @@ message JobStatus {
|
|||||||
// +optional
|
// +optional
|
||||||
// +patchMergeKey=type
|
// +patchMergeKey=type
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
|
// +listType=atomic
|
||||||
repeated JobCondition conditions = 1;
|
repeated JobCondition conditions = 1;
|
||||||
|
|
||||||
// Represents time when the job was acknowledged by the job controller.
|
// Represents time when the job was acknowledged by the job controller.
|
||||||
@@ -216,3 +299,16 @@ message JobStatus {
|
|||||||
optional string completedIndexes = 7;
|
optional string completedIndexes = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JobTemplateSpec describes the data a Job should have when created from a template
|
||||||
|
message JobTemplateSpec {
|
||||||
|
// Standard object's metadata of the jobs created from this template.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||||
|
|
||||||
|
// Specification of the desired behavior of the job.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
// +optional
|
||||||
|
optional JobSpec spec = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
&Job{},
|
&Job{},
|
||||||
&JobList{},
|
&JobList{},
|
||||||
|
&CronJob{},
|
||||||
|
&CronJobList{},
|
||||||
)
|
)
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
return nil
|
return nil
|
||||||
|
@@ -176,6 +176,7 @@ type JobStatus struct {
|
|||||||
// +optional
|
// +optional
|
||||||
// +patchMergeKey=type
|
// +patchMergeKey=type
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
|
// +listType=atomic
|
||||||
Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
|
Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
|
||||||
|
|
||||||
// Represents time when the job was acknowledged by the job controller.
|
// Represents time when the job was acknowledged by the job controller.
|
||||||
@@ -243,3 +244,125 @@ type JobCondition struct {
|
|||||||
// +optional
|
// +optional
|
||||||
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
|
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JobTemplateSpec describes the data a Job should have when created from a template
|
||||||
|
type JobTemplateSpec struct {
|
||||||
|
// Standard object's metadata of the jobs created from this template.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// Specification of the desired behavior of the job.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
// +optional
|
||||||
|
Spec JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// CronJob represents the configuration of a single cron job.
|
||||||
|
type CronJob 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,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// Specification of the desired behavior of a cron job, including the schedule.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
// +optional
|
||||||
|
Spec CronJobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||||
|
|
||||||
|
// Current status of a cron job.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
// +optional
|
||||||
|
Status CronJobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// CronJobList is a collection of cron jobs.
|
||||||
|
type CronJobList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
|
// Standard list metadata.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// items is the list of CronJobs.
|
||||||
|
Items []CronJob `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobSpec describes how the job execution will look like and when it will actually run.
|
||||||
|
type CronJobSpec struct {
|
||||||
|
|
||||||
|
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
|
||||||
|
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
|
||||||
|
|
||||||
|
// Optional deadline in seconds for starting the job if it misses scheduled
|
||||||
|
// time for any reason. Missed jobs executions will be counted as failed ones.
|
||||||
|
// +optional
|
||||||
|
StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty" protobuf:"varint,2,opt,name=startingDeadlineSeconds"`
|
||||||
|
|
||||||
|
// Specifies how to treat concurrent executions of a Job.
|
||||||
|
// Valid values are:
|
||||||
|
// - "Allow" (default): allows CronJobs 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
|
||||||
|
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty" protobuf:"bytes,3,opt,name=concurrencyPolicy,casttype=ConcurrencyPolicy"`
|
||||||
|
|
||||||
|
// This flag tells the controller to suspend subsequent executions, it does
|
||||||
|
// not apply to already started executions. Defaults to false.
|
||||||
|
// +optional
|
||||||
|
Suspend *bool `json:"suspend,omitempty" protobuf:"varint,4,opt,name=suspend"`
|
||||||
|
|
||||||
|
// Specifies the job that will be created when executing a CronJob.
|
||||||
|
JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"`
|
||||||
|
|
||||||
|
// The number of successful finished jobs to retain. Value must be non-negative integer.
|
||||||
|
// Defaults to 3.
|
||||||
|
// +optional
|
||||||
|
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty" protobuf:"varint,6,opt,name=successfulJobsHistoryLimit"`
|
||||||
|
|
||||||
|
// The number of failed finished jobs to retain. Value must be non-negative integer.
|
||||||
|
// Defaults to 1.
|
||||||
|
// +optional
|
||||||
|
FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty" protobuf:"varint,7,opt,name=failedJobsHistoryLimit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConcurrencyPolicy describes how the 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 AllowConcurrent.
|
||||||
|
type ConcurrencyPolicy string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// AllowConcurrent allows CronJobs to run concurrently.
|
||||||
|
AllowConcurrent ConcurrencyPolicy = "Allow"
|
||||||
|
|
||||||
|
// ForbidConcurrent forbids concurrent runs, skipping next run if previous
|
||||||
|
// hasn't finished yet.
|
||||||
|
ForbidConcurrent ConcurrencyPolicy = "Forbid"
|
||||||
|
|
||||||
|
// ReplaceConcurrent cancels currently running job and replaces it with a new one.
|
||||||
|
ReplaceConcurrent ConcurrencyPolicy = "Replace"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobStatus represents the current state of a cron job.
|
||||||
|
type CronJobStatus struct {
|
||||||
|
// A list of pointers to currently running jobs.
|
||||||
|
// +optional
|
||||||
|
// +listType=atomic
|
||||||
|
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
|
||||||
|
|
||||||
|
// Information when was the last time the job was successfully scheduled.
|
||||||
|
// +optional
|
||||||
|
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty" protobuf:"bytes,4,opt,name=lastScheduleTime"`
|
||||||
|
|
||||||
|
// Information when was the last time the job successfully completed.
|
||||||
|
// +optional
|
||||||
|
LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty" protobuf:"bytes,5,opt,name=lastSuccessfulTime"`
|
||||||
|
}
|
||||||
|
@@ -27,6 +27,53 @@ package v1
|
|||||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||||
|
|
||||||
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
|
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
|
||||||
|
var map_CronJob = map[string]string{
|
||||||
|
"": "CronJob represents the configuration of a single cron job.",
|
||||||
|
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||||
|
"spec": "Specification of the desired behavior of a cron job, including the schedule. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||||
|
"status": "Current status of a cron job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (CronJob) SwaggerDoc() map[string]string {
|
||||||
|
return map_CronJob
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_CronJobList = map[string]string{
|
||||||
|
"": "CronJobList is a collection of cron jobs.",
|
||||||
|
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||||
|
"items": "items is the list of CronJobs.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (CronJobList) SwaggerDoc() map[string]string {
|
||||||
|
return map_CronJobList
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_CronJobSpec = map[string]string{
|
||||||
|
"": "CronJobSpec describes how the job execution will look like and when it will actually run.",
|
||||||
|
"schedule": "The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
|
||||||
|
"startingDeadlineSeconds": "Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Missed jobs executions will be counted as failed ones.",
|
||||||
|
"concurrencyPolicy": "Specifies how to treat concurrent executions of a Job. Valid values are: - \"Allow\" (default): allows CronJobs 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",
|
||||||
|
"suspend": "This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",
|
||||||
|
"jobTemplate": "Specifies the job that will be created when executing a CronJob.",
|
||||||
|
"successfulJobsHistoryLimit": "The number of successful finished jobs to retain. Value must be non-negative integer. Defaults to 3.",
|
||||||
|
"failedJobsHistoryLimit": "The number of failed finished jobs to retain. Value must be non-negative integer. Defaults to 1.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (CronJobSpec) SwaggerDoc() map[string]string {
|
||||||
|
return map_CronJobSpec
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_CronJobStatus = map[string]string{
|
||||||
|
"": "CronJobStatus represents the current state of a cron job.",
|
||||||
|
"active": "A list of pointers to currently running jobs.",
|
||||||
|
"lastScheduleTime": "Information when was the last time the job was successfully scheduled.",
|
||||||
|
"lastSuccessfulTime": "Information when was the last time the job successfully completed.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (CronJobStatus) SwaggerDoc() map[string]string {
|
||||||
|
return map_CronJobStatus
|
||||||
|
}
|
||||||
|
|
||||||
var map_Job = map[string]string{
|
var map_Job = map[string]string{
|
||||||
"": "Job represents the configuration of a single job.",
|
"": "Job represents the configuration of a single job.",
|
||||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||||
@@ -94,4 +141,14 @@ func (JobStatus) SwaggerDoc() map[string]string {
|
|||||||
return map_JobStatus
|
return map_JobStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var map_JobTemplateSpec = map[string]string{
|
||||||
|
"": "JobTemplateSpec describes the data a Job should have when created from a template",
|
||||||
|
"metadata": "Standard object's metadata of the jobs created from this template. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||||
|
"spec": "Specification of the desired behavior of the job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (JobTemplateSpec) SwaggerDoc() map[string]string {
|
||||||
|
return map_JobTemplateSpec
|
||||||
|
}
|
||||||
|
|
||||||
// AUTO-GENERATED FUNCTIONS END HERE
|
// AUTO-GENERATED FUNCTIONS END HERE
|
||||||
|
146
staging/src/k8s.io/api/batch/v1/zz_generated.deepcopy.go
generated
146
staging/src/k8s.io/api/batch/v1/zz_generated.deepcopy.go
generated
@@ -21,10 +21,138 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *CronJob) DeepCopyInto(out *CronJob) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronJob.
|
||||||
|
func (in *CronJob) DeepCopy() *CronJob {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(CronJob)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *CronJob) 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 *CronJobList) DeepCopyInto(out *CronJobList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]CronJob, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronJobList.
|
||||||
|
func (in *CronJobList) DeepCopy() *CronJobList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(CronJobList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *CronJobList) 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 *CronJobSpec) DeepCopyInto(out *CronJobSpec) {
|
||||||
|
*out = *in
|
||||||
|
if in.StartingDeadlineSeconds != nil {
|
||||||
|
in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds
|
||||||
|
*out = new(int64)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.Suspend != nil {
|
||||||
|
in, out := &in.Suspend, &out.Suspend
|
||||||
|
*out = new(bool)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
in.JobTemplate.DeepCopyInto(&out.JobTemplate)
|
||||||
|
if in.SuccessfulJobsHistoryLimit != nil {
|
||||||
|
in, out := &in.SuccessfulJobsHistoryLimit, &out.SuccessfulJobsHistoryLimit
|
||||||
|
*out = new(int32)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.FailedJobsHistoryLimit != nil {
|
||||||
|
in, out := &in.FailedJobsHistoryLimit, &out.FailedJobsHistoryLimit
|
||||||
|
*out = new(int32)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronJobSpec.
|
||||||
|
func (in *CronJobSpec) DeepCopy() *CronJobSpec {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(CronJobSpec)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *CronJobStatus) DeepCopyInto(out *CronJobStatus) {
|
||||||
|
*out = *in
|
||||||
|
if in.Active != nil {
|
||||||
|
in, out := &in.Active, &out.Active
|
||||||
|
*out = make([]corev1.ObjectReference, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
if in.LastScheduleTime != nil {
|
||||||
|
in, out := &in.LastScheduleTime, &out.LastScheduleTime
|
||||||
|
*out = (*in).DeepCopy()
|
||||||
|
}
|
||||||
|
if in.LastSuccessfulTime != nil {
|
||||||
|
in, out := &in.LastSuccessfulTime, &out.LastSuccessfulTime
|
||||||
|
*out = (*in).DeepCopy()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronJobStatus.
|
||||||
|
func (in *CronJobStatus) DeepCopy() *CronJobStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(CronJobStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Job) DeepCopyInto(out *Job) {
|
func (in *Job) DeepCopyInto(out *Job) {
|
||||||
*out = *in
|
*out = *in
|
||||||
@@ -186,3 +314,21 @@ func (in *JobStatus) DeepCopy() *JobStatus {
|
|||||||
in.DeepCopyInto(out)
|
in.DeepCopyInto(out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *JobTemplateSpec) DeepCopyInto(out *JobTemplateSpec) {
|
||||||
|
*out = *in
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobTemplateSpec.
|
||||||
|
func (in *JobTemplateSpec) DeepCopy() *JobTemplateSpec {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(JobTemplateSpec)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
154
staging/src/k8s.io/api/batch/v1beta1/generated.pb.go
generated
154
staging/src/k8s.io/api/batch/v1beta1/generated.pb.go
generated
@@ -227,56 +227,57 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_e57b277b05179ae7 = []byte{
|
var fileDescriptor_e57b277b05179ae7 = []byte{
|
||||||
// 771 bytes of a gzipped FileDescriptorProto
|
// 794 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0x6f, 0xe3, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x41, 0x6f, 0x1b, 0x45,
|
||||||
0x14, 0xc7, 0xe3, 0x34, 0xbf, 0x76, 0xc2, 0x42, 0xd7, 0xa0, 0x5d, 0x2b, 0x20, 0x27, 0x64, 0xb5,
|
0x14, 0xc7, 0xbd, 0x4e, 0x1c, 0xbb, 0x63, 0x0a, 0xe9, 0x80, 0x52, 0xcb, 0xa0, 0xdd, 0xe0, 0xaa,
|
||||||
0x22, 0x20, 0x76, 0x4c, 0x2b, 0x84, 0x38, 0x21, 0xad, 0x17, 0x2d, 0x50, 0x8a, 0x16, 0x39, 0x45,
|
0x22, 0x20, 0x3a, 0x4b, 0x22, 0x84, 0x38, 0x21, 0x75, 0x8b, 0x0a, 0x84, 0xa0, 0xa2, 0x71, 0x11,
|
||||||
0x48, 0xa8, 0x42, 0x1d, 0x8f, 0x5f, 0x92, 0x69, 0x6c, 0x8f, 0xe5, 0x19, 0x47, 0xca, 0x8d, 0x0b,
|
0x12, 0xaa, 0x50, 0x67, 0x67, 0x5f, 0x9c, 0x69, 0x76, 0x77, 0x56, 0x3b, 0xb3, 0x91, 0x72, 0xe3,
|
||||||
0x77, 0xfe, 0x11, 0x4e, 0xfc, 0x13, 0x11, 0xa7, 0x1e, 0x7b, 0x8a, 0xa8, 0xf9, 0x2f, 0x38, 0x21,
|
0xc2, 0x9d, 0x2f, 0xc2, 0x89, 0x3b, 0xe7, 0x1c, 0x7b, 0xec, 0x69, 0x45, 0x96, 0x6f, 0xc1, 0x09,
|
||||||
0x4f, 0x9c, 0x1f, 0xcd, 0x8f, 0xb6, 0x7b, 0xe9, 0xcd, 0xf3, 0xe6, 0xfb, 0xfd, 0xcc, 0xf3, 0x7b,
|
0xed, 0x78, 0xbd, 0x76, 0xed, 0x75, 0xd3, 0x5e, 0x72, 0xf3, 0xbc, 0xf9, 0xff, 0x7f, 0xf3, 0xf6,
|
||||||
0x6f, 0x06, 0xbd, 0x18, 0x7e, 0x29, 0x30, 0xe3, 0xd6, 0x30, 0x71, 0x21, 0x0e, 0x41, 0x82, 0xb0,
|
0xbd, 0x37, 0x63, 0x74, 0xff, 0xf4, 0x4b, 0x45, 0x84, 0x74, 0x4f, 0x33, 0x1f, 0xd2, 0x18, 0x34,
|
||||||
0x46, 0x10, 0x7a, 0x3c, 0xb6, 0xf2, 0x0d, 0x12, 0x31, 0xcb, 0x25, 0x92, 0x0e, 0xac, 0xd1, 0x81,
|
0x28, 0xf7, 0x0c, 0xe2, 0x40, 0xa6, 0x6e, 0xb5, 0xc1, 0x12, 0xe1, 0xfa, 0x4c, 0xf3, 0x13, 0xf7,
|
||||||
0x0b, 0x92, 0x1c, 0x58, 0x7d, 0x08, 0x21, 0x26, 0x12, 0x3c, 0x1c, 0xc5, 0x5c, 0x72, 0xdd, 0x98,
|
0x6c, 0xdf, 0x07, 0xcd, 0xf6, 0xdd, 0x09, 0xc4, 0x90, 0x32, 0x0d, 0x01, 0x49, 0x52, 0xa9, 0x25,
|
||||||
0x29, 0x31, 0x89, 0x18, 0x56, 0x4a, 0x9c, 0x2b, 0x1b, 0xcf, 0xfb, 0x4c, 0x0e, 0x12, 0x17, 0x53,
|
0x1e, 0x4c, 0x95, 0x84, 0x25, 0x82, 0x18, 0x25, 0xa9, 0x94, 0xc3, 0x7b, 0x13, 0xa1, 0x4f, 0x32,
|
||||||
0x1e, 0x58, 0x7d, 0xde, 0xe7, 0x96, 0x32, 0xb8, 0x49, 0x4f, 0xad, 0xd4, 0x42, 0x7d, 0xcd, 0x40,
|
0x9f, 0x70, 0x19, 0xb9, 0x13, 0x39, 0x91, 0xae, 0x31, 0xf8, 0xd9, 0xb1, 0x59, 0x99, 0x85, 0xf9,
|
||||||
0x8d, 0xa7, 0x5b, 0x8e, 0x5c, 0x3f, 0xad, 0xd1, 0x5e, 0x11, 0x51, 0x1e, 0xc3, 0x36, 0xcd, 0xe7,
|
0x35, 0x05, 0x0d, 0xef, 0x34, 0x1c, 0xb9, 0x7c, 0xda, 0x70, 0xb4, 0x20, 0xe2, 0x32, 0x85, 0x26,
|
||||||
0x4b, 0x4d, 0x40, 0xe8, 0x80, 0x85, 0x10, 0x8f, 0xad, 0x68, 0xd8, 0xcf, 0x02, 0xc2, 0x0a, 0x40,
|
0xcd, 0xe7, 0x73, 0x4d, 0xc4, 0xf8, 0x89, 0x88, 0x21, 0x3d, 0x77, 0x93, 0xd3, 0x49, 0x19, 0x50,
|
||||||
0x92, 0x6d, 0x2e, 0x6b, 0x97, 0x2b, 0x4e, 0x42, 0xc9, 0x02, 0xd8, 0x30, 0x7c, 0x71, 0x9b, 0x41,
|
0x6e, 0x04, 0x9a, 0x35, 0xb9, 0xdc, 0x75, 0xae, 0x34, 0x8b, 0xb5, 0x88, 0x60, 0xc5, 0xf0, 0xc5,
|
||||||
0xd0, 0x01, 0x04, 0x64, 0xdd, 0xd7, 0xfe, 0xbd, 0x88, 0xaa, 0x2f, 0x63, 0x1e, 0x1e, 0x71, 0x57,
|
0x55, 0x06, 0xc5, 0x4f, 0x20, 0x62, 0xcb, 0xbe, 0xd1, 0xef, 0x6d, 0xd4, 0x7d, 0x90, 0xca, 0xf8,
|
||||||
0x3f, 0x43, 0xb5, 0x2c, 0x1f, 0x8f, 0x48, 0x62, 0x68, 0x2d, 0xad, 0x53, 0x3f, 0xfc, 0x0c, 0x2f,
|
0x50, 0xfa, 0xf8, 0x29, 0xea, 0x95, 0xf9, 0x04, 0x4c, 0xb3, 0x81, 0xb5, 0x6b, 0xed, 0xf5, 0x0f,
|
||||||
0xeb, 0xb9, 0xc0, 0xe2, 0x68, 0xd8, 0xcf, 0x02, 0x02, 0x67, 0x6a, 0x3c, 0x3a, 0xc0, 0xaf, 0xdd,
|
0x3e, 0x23, 0xf3, 0x7a, 0xd6, 0x58, 0x92, 0x9c, 0x4e, 0xca, 0x80, 0x22, 0xa5, 0x9a, 0x9c, 0xed,
|
||||||
0x73, 0xa0, 0xf2, 0x07, 0x90, 0xc4, 0xd6, 0x27, 0xd3, 0x66, 0x21, 0x9d, 0x36, 0xd1, 0x32, 0xe6,
|
0x93, 0x47, 0xfe, 0x33, 0xe0, 0xfa, 0x07, 0xd0, 0xcc, 0xc3, 0x17, 0xb9, 0xd3, 0x2a, 0x72, 0x07,
|
||||||
0x2c, 0xa8, 0xfa, 0x37, 0xa8, 0x24, 0x22, 0xa0, 0x46, 0x51, 0xd1, 0x9f, 0xe1, 0x5d, 0xdd, 0xc2,
|
0xcd, 0x63, 0xb4, 0xa6, 0xe2, 0x6f, 0xd0, 0xa6, 0x4a, 0x80, 0x0f, 0xda, 0x86, 0x7e, 0x97, 0xac,
|
||||||
0x79, 0x4a, 0xdd, 0x08, 0xa8, 0xfd, 0x56, 0x8e, 0x2c, 0x65, 0x2b, 0x47, 0x01, 0xf4, 0xd7, 0xa8,
|
0xeb, 0x16, 0xa9, 0x52, 0x1a, 0x27, 0xc0, 0xbd, 0xb7, 0x2a, 0xe4, 0x66, 0xb9, 0xa2, 0x06, 0x80,
|
||||||
0x22, 0x24, 0x91, 0x89, 0x30, 0xf6, 0x14, 0xea, 0xa3, 0xdb, 0x51, 0x4a, 0x6e, 0xbf, 0x9d, 0xc3,
|
0x1f, 0xa1, 0x2d, 0xa5, 0x99, 0xce, 0xd4, 0x60, 0xc3, 0xa0, 0x3e, 0xba, 0x1a, 0x65, 0xe4, 0xde,
|
||||||
0x2a, 0xb3, 0xb5, 0x93, 0x63, 0xda, 0x7f, 0x69, 0xa8, 0x9e, 0x2b, 0x8f, 0x99, 0x90, 0xfa, 0xe9,
|
0xdb, 0x15, 0x6c, 0x6b, 0xba, 0xa6, 0x15, 0x66, 0xf4, 0x97, 0x85, 0xfa, 0x95, 0xf2, 0x48, 0x28,
|
||||||
0x46, 0x2d, 0xf0, 0xdd, 0x6a, 0x91, 0xb9, 0x55, 0x25, 0xf6, 0xf3, 0x93, 0x6a, 0xf3, 0xc8, 0x4a,
|
0x8d, 0x9f, 0xac, 0xd4, 0x82, 0xbc, 0x5e, 0x2d, 0x4a, 0xb7, 0xa9, 0xc4, 0x76, 0x75, 0x52, 0x6f,
|
||||||
0x1d, 0x5e, 0xa1, 0x32, 0x93, 0x10, 0x08, 0xa3, 0xd8, 0xda, 0xeb, 0xd4, 0x0f, 0x3f, 0xbc, 0x35,
|
0x16, 0x59, 0xa8, 0xc3, 0x43, 0xd4, 0x11, 0x1a, 0x22, 0x35, 0x68, 0xef, 0x6e, 0xec, 0xf5, 0x0f,
|
||||||
0x7b, 0xfb, 0x61, 0x4e, 0x2b, 0x7f, 0x97, 0xf9, 0x9c, 0x99, 0xbd, 0xfd, 0x67, 0x69, 0x91, 0x75,
|
0x3e, 0xbc, 0x32, 0x7b, 0xef, 0x66, 0x45, 0xeb, 0x7c, 0x57, 0xfa, 0xe8, 0xd4, 0x3e, 0xfa, 0x73,
|
||||||
0x56, 0x1c, 0xfd, 0x53, 0x54, 0xcb, 0xfa, 0xec, 0x25, 0x3e, 0xa8, 0xac, 0x1f, 0x2c, 0xb3, 0xe8,
|
0xb3, 0xce, 0xba, 0x2c, 0x0e, 0xfe, 0x14, 0xf5, 0xca, 0x3e, 0x07, 0x59, 0x08, 0x26, 0xeb, 0x1b,
|
||||||
0xe6, 0x71, 0x67, 0xa1, 0xd0, 0x7f, 0x42, 0x4f, 0x84, 0x24, 0xb1, 0x64, 0x61, 0xff, 0x6b, 0x20,
|
0xf3, 0x2c, 0xc6, 0x55, 0x9c, 0xd6, 0x0a, 0xfc, 0x13, 0xba, 0xad, 0x34, 0x4b, 0xb5, 0x88, 0x27,
|
||||||
0x9e, 0xcf, 0x42, 0xe8, 0x02, 0xe5, 0xa1, 0x27, 0x54, 0x83, 0xf6, 0xec, 0xf7, 0xd3, 0x69, 0xf3,
|
0x5f, 0x03, 0x0b, 0x42, 0x11, 0xc3, 0x18, 0xb8, 0x8c, 0x03, 0x65, 0x1a, 0xb4, 0xe1, 0xbd, 0x5f,
|
||||||
0x49, 0x77, 0xbb, 0xc4, 0xd9, 0xe5, 0xd5, 0x4f, 0xd1, 0x23, 0xca, 0x43, 0x9a, 0xc4, 0x31, 0x84,
|
0xe4, 0xce, 0xed, 0x71, 0xb3, 0x84, 0xae, 0xf3, 0xe2, 0x27, 0xe8, 0x16, 0x97, 0x31, 0xcf, 0xd2,
|
||||||
0x74, 0xfc, 0x23, 0xf7, 0x19, 0x1d, 0xab, 0x36, 0x3d, 0xb0, 0x71, 0x9e, 0xcd, 0xa3, 0x97, 0xeb,
|
0x14, 0x62, 0x7e, 0xfe, 0xa3, 0x0c, 0x05, 0x3f, 0x37, 0x6d, 0xba, 0xe1, 0x91, 0x2a, 0x9b, 0x5b,
|
||||||
0x82, 0xff, 0xb6, 0x05, 0x9d, 0x4d, 0x90, 0xfe, 0x0c, 0x55, 0x45, 0x22, 0x22, 0x08, 0x3d, 0xa3,
|
0x0f, 0x96, 0x05, 0xff, 0x35, 0x05, 0xe9, 0x2a, 0x08, 0xdf, 0x45, 0x5d, 0x95, 0xa9, 0x04, 0xe2,
|
||||||
0xd4, 0xd2, 0x3a, 0x35, 0xbb, 0x9e, 0x4e, 0x9b, 0xd5, 0xee, 0x2c, 0xe4, 0xcc, 0xf7, 0xf4, 0x33,
|
0x60, 0xb0, 0xb9, 0x6b, 0xed, 0xf5, 0xbc, 0x7e, 0x91, 0x3b, 0xdd, 0xf1, 0x34, 0x44, 0x67, 0x7b,
|
||||||
0x54, 0x3f, 0xe7, 0xee, 0x09, 0x04, 0x91, 0x4f, 0x24, 0x18, 0x65, 0xd5, 0xc2, 0x8f, 0x77, 0xd7,
|
0xf8, 0x29, 0xea, 0x3f, 0x93, 0xfe, 0x63, 0x88, 0x92, 0x90, 0x69, 0x18, 0x74, 0x4c, 0x0b, 0x3f,
|
||||||
0xf9, 0x68, 0x29, 0x56, 0x43, 0xf7, 0x6e, 0x9e, 0x69, 0x7d, 0x65, 0xc3, 0x59, 0x45, 0xea, 0xbf,
|
0x5e, 0x5f, 0xe7, 0xc3, 0xb9, 0xd8, 0x0c, 0xdd, 0xbb, 0x55, 0xa6, 0xfd, 0x85, 0x0d, 0xba, 0x88,
|
||||||
0xa2, 0x86, 0x48, 0x28, 0x05, 0x21, 0x7a, 0x89, 0x7f, 0xc4, 0x5d, 0xf1, 0x2d, 0x13, 0x92, 0xc7,
|
0xc4, 0xbf, 0xa2, 0xa1, 0xca, 0x38, 0x07, 0xa5, 0x8e, 0xb3, 0xf0, 0x50, 0xfa, 0xea, 0x5b, 0xa1,
|
||||||
0xe3, 0x63, 0x16, 0x30, 0x69, 0x54, 0x5a, 0x5a, 0xa7, 0x6c, 0x9b, 0xe9, 0xb4, 0xd9, 0xe8, 0xee,
|
0xb4, 0x4c, 0xcf, 0x8f, 0x44, 0x24, 0xf4, 0x60, 0x6b, 0xd7, 0xda, 0xeb, 0x78, 0x76, 0x91, 0x3b,
|
||||||
0x54, 0x39, 0x37, 0x10, 0x74, 0x07, 0x3d, 0xee, 0x11, 0xe6, 0x83, 0xb7, 0xc1, 0xae, 0x2a, 0x76,
|
0xc3, 0xf1, 0x5a, 0x15, 0x7d, 0x05, 0x01, 0x53, 0xb4, 0x73, 0xcc, 0x44, 0x08, 0xc1, 0x0a, 0xbb,
|
||||||
0x23, 0x9d, 0x36, 0x1f, 0xbf, 0xda, 0xaa, 0x70, 0x76, 0x38, 0xdb, 0x7f, 0x6b, 0xe8, 0xe1, 0xb5,
|
0x6b, 0xd8, 0xc3, 0x22, 0x77, 0x76, 0x1e, 0x36, 0x2a, 0xe8, 0x1a, 0xe7, 0xe8, 0xef, 0x36, 0xba,
|
||||||
0xfb, 0xa0, 0x7f, 0x8f, 0x2a, 0x84, 0x4a, 0x36, 0xca, 0xe6, 0x25, 0x1b, 0xc5, 0xa7, 0xab, 0x25,
|
0xf9, 0xd2, 0x7d, 0xc0, 0xdf, 0xa3, 0x2d, 0xc6, 0xb5, 0x38, 0x2b, 0xe7, 0xa5, 0x1c, 0xc5, 0x3b,
|
||||||
0xca, 0xde, 0xb4, 0xe5, 0xfd, 0x76, 0xa0, 0x07, 0x59, 0x27, 0x60, 0x79, 0x89, 0x5e, 0x28, 0xab,
|
0x8b, 0x25, 0x2a, 0xdf, 0xb4, 0xf9, 0xfd, 0xa6, 0x70, 0x0c, 0x65, 0x27, 0x60, 0x7e, 0x89, 0xee,
|
||||||
0x93, 0x23, 0x74, 0x1f, 0xed, 0xfb, 0x44, 0xc8, 0xf9, 0xa8, 0x9d, 0xb0, 0x00, 0x54, 0x93, 0xea,
|
0x1b, 0x2b, 0xad, 0x10, 0x38, 0x44, 0xdb, 0x21, 0x53, 0x7a, 0x36, 0x6a, 0x8f, 0x45, 0x04, 0xa6,
|
||||||
0x87, 0x9f, 0xdc, 0xed, 0xf2, 0x64, 0x0e, 0xfb, 0xbd, 0x74, 0xda, 0xdc, 0x3f, 0x5e, 0xe3, 0x38,
|
0x49, 0xfd, 0x83, 0x4f, 0x5e, 0xef, 0xf2, 0x94, 0x0e, 0xef, 0xbd, 0x22, 0x77, 0xb6, 0x8f, 0x96,
|
||||||
0x1b, 0xe4, 0xf6, 0x44, 0x43, 0xab, 0xdd, 0xb9, 0x87, 0xe7, 0xeb, 0x67, 0x54, 0x93, 0xf3, 0x89,
|
0x38, 0x74, 0x85, 0x8c, 0x53, 0x84, 0x4d, 0xac, 0x2e, 0xa1, 0x39, 0xaf, 0xf3, 0xc6, 0xe7, 0xed,
|
||||||
0x2a, 0xbe, 0xe9, 0x44, 0x2d, 0x6e, 0xe2, 0x62, 0x9c, 0x16, 0xb0, 0xec, 0xf5, 0x79, 0x67, 0x4d,
|
0x14, 0xb9, 0x83, 0x8f, 0x56, 0x48, 0xb4, 0x81, 0x3e, 0xba, 0xb0, 0xd0, 0xe2, 0x44, 0x5c, 0xc3,
|
||||||
0x7f, 0x0f, 0xbf, 0xf3, 0xd5, 0xb5, 0xd7, 0xf8, 0x83, 0x6d, 0xbf, 0x82, 0x6f, 0x78, 0x84, 0xed,
|
0x93, 0xf9, 0x33, 0xea, 0xe9, 0xd9, 0x14, 0xb7, 0xdf, 0x74, 0x8a, 0xeb, 0xdb, 0x5f, 0x8f, 0x70,
|
||||||
0xe7, 0x93, 0x2b, 0xb3, 0x70, 0x71, 0x65, 0x16, 0x2e, 0xaf, 0xcc, 0xc2, 0x6f, 0xa9, 0xa9, 0x4d,
|
0x0d, 0x2b, 0x5f, 0xbc, 0x77, 0x96, 0xf4, 0xd7, 0xf0, 0x39, 0x5f, 0xbd, 0xf4, 0x0f, 0xf0, 0x41,
|
||||||
0x52, 0x53, 0xbb, 0x48, 0x4d, 0xed, 0x32, 0x35, 0xb5, 0x7f, 0x52, 0x53, 0xfb, 0xe3, 0x5f, 0xb3,
|
0xd3, 0xa7, 0x90, 0x57, 0x3c, 0xfc, 0xde, 0xbd, 0x8b, 0x4b, 0xbb, 0xf5, 0xfc, 0xd2, 0x6e, 0xbd,
|
||||||
0xf0, 0x4b, 0x35, 0x2f, 0xc8, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x9f, 0xb3, 0xdd, 0xdf,
|
0xb8, 0xb4, 0x5b, 0xbf, 0x15, 0xb6, 0x75, 0x51, 0xd8, 0xd6, 0xf3, 0xc2, 0xb6, 0x5e, 0x14, 0xb6,
|
||||||
0x07, 0x00, 0x00,
|
0xf5, 0x4f, 0x61, 0x5b, 0x7f, 0xfc, 0x6b, 0xb7, 0x7e, 0xe9, 0x56, 0x05, 0xf9, 0x3f, 0x00, 0x00,
|
||||||
|
0xff, 0xff, 0xe9, 0xe0, 0x40, 0x92, 0x53, 0x08, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CronJob) Marshal() (dAtA []byte, err error) {
|
func (m *CronJob) Marshal() (dAtA []byte, err error) {
|
||||||
@@ -467,6 +468,18 @@ func (m *CronJobStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
if m.LastSuccessfulTime != nil {
|
||||||
|
{
|
||||||
|
size, err := m.LastSuccessfulTime.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x2a
|
||||||
|
}
|
||||||
if m.LastScheduleTime != nil {
|
if m.LastScheduleTime != nil {
|
||||||
{
|
{
|
||||||
size, err := m.LastScheduleTime.MarshalToSizedBuffer(dAtA[:i])
|
size, err := m.LastScheduleTime.MarshalToSizedBuffer(dAtA[:i])
|
||||||
@@ -668,6 +681,10 @@ func (m *CronJobStatus) Size() (n int) {
|
|||||||
l = m.LastScheduleTime.Size()
|
l = m.LastScheduleTime.Size()
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
}
|
}
|
||||||
|
if m.LastSuccessfulTime != nil {
|
||||||
|
l = m.LastSuccessfulTime.Size()
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,6 +776,7 @@ func (this *CronJobStatus) String() string {
|
|||||||
s := strings.Join([]string{`&CronJobStatus{`,
|
s := strings.Join([]string{`&CronJobStatus{`,
|
||||||
`Active:` + repeatedStringForActive + `,`,
|
`Active:` + repeatedStringForActive + `,`,
|
||||||
`LastScheduleTime:` + strings.Replace(fmt.Sprintf("%v", this.LastScheduleTime), "Time", "v1.Time", 1) + `,`,
|
`LastScheduleTime:` + strings.Replace(fmt.Sprintf("%v", this.LastScheduleTime), "Time", "v1.Time", 1) + `,`,
|
||||||
|
`LastSuccessfulTime:` + strings.Replace(fmt.Sprintf("%v", this.LastSuccessfulTime), "Time", "v1.Time", 1) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@@ -1386,6 +1404,42 @@ func (m *CronJobStatus) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 5:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field LastSuccessfulTime", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if m.LastSuccessfulTime == nil {
|
||||||
|
m.LastSuccessfulTime = &v1.Time{}
|
||||||
|
}
|
||||||
|
if err := m.LastSuccessfulTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
|
@@ -102,11 +102,16 @@ message CronJobSpec {
|
|||||||
message CronJobStatus {
|
message CronJobStatus {
|
||||||
// A list of pointers to currently running jobs.
|
// A list of pointers to currently running jobs.
|
||||||
// +optional
|
// +optional
|
||||||
|
// +listType=atomic
|
||||||
repeated k8s.io.api.core.v1.ObjectReference active = 1;
|
repeated k8s.io.api.core.v1.ObjectReference active = 1;
|
||||||
|
|
||||||
// Information when was the last time the job was successfully scheduled.
|
// Information when was the last time the job was successfully scheduled.
|
||||||
// +optional
|
// +optional
|
||||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScheduleTime = 4;
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScheduleTime = 4;
|
||||||
|
|
||||||
|
// Information when was the last time the job successfully completed.
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSuccessfulTime = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobTemplate describes a template for creating copies of a predefined pod.
|
// JobTemplate describes a template for creating copies of a predefined pod.
|
||||||
|
@@ -56,7 +56,9 @@ type JobTemplateSpec struct {
|
|||||||
// +genclient
|
// +genclient
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
||||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.22
|
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||||
|
// +k8s:prerelease-lifecycle-gen:removed=1.25
|
||||||
|
// +k8s:prerelease-lifecycle-gen:replacement=batch,v1,CronJob
|
||||||
|
|
||||||
// CronJob represents the configuration of a single cron job.
|
// CronJob represents the configuration of a single cron job.
|
||||||
type CronJob struct {
|
type CronJob struct {
|
||||||
@@ -79,7 +81,9 @@ type CronJob struct {
|
|||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
||||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.22
|
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||||
|
// +k8s:prerelease-lifecycle-gen:removed=1.25
|
||||||
|
// +k8s:prerelease-lifecycle-gen:replacement=batch,v1,CronJobList
|
||||||
|
|
||||||
// CronJobList is a collection of cron jobs.
|
// CronJobList is a collection of cron jobs.
|
||||||
type CronJobList struct {
|
type CronJobList struct {
|
||||||
@@ -156,9 +160,14 @@ const (
|
|||||||
type CronJobStatus struct {
|
type CronJobStatus struct {
|
||||||
// A list of pointers to currently running jobs.
|
// A list of pointers to currently running jobs.
|
||||||
// +optional
|
// +optional
|
||||||
|
// +listType=atomic
|
||||||
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
|
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
|
||||||
|
|
||||||
// Information when was the last time the job was successfully scheduled.
|
// Information when was the last time the job was successfully scheduled.
|
||||||
// +optional
|
// +optional
|
||||||
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty" protobuf:"bytes,4,opt,name=lastScheduleTime"`
|
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty" protobuf:"bytes,4,opt,name=lastScheduleTime"`
|
||||||
|
|
||||||
|
// Information when was the last time the job successfully completed.
|
||||||
|
// +optional
|
||||||
|
LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty" protobuf:"bytes,5,opt,name=lastSuccessfulTime"`
|
||||||
}
|
}
|
||||||
|
@@ -67,6 +67,7 @@ var map_CronJobStatus = map[string]string{
|
|||||||
"": "CronJobStatus represents the current state of a cron job.",
|
"": "CronJobStatus represents the current state of a cron job.",
|
||||||
"active": "A list of pointers to currently running jobs.",
|
"active": "A list of pointers to currently running jobs.",
|
||||||
"lastScheduleTime": "Information when was the last time the job was successfully scheduled.",
|
"lastScheduleTime": "Information when was the last time the job was successfully scheduled.",
|
||||||
|
"lastSuccessfulTime": "Information when was the last time the job successfully completed.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (CronJobStatus) SwaggerDoc() map[string]string {
|
func (CronJobStatus) SwaggerDoc() map[string]string {
|
||||||
|
@@ -135,6 +135,10 @@ func (in *CronJobStatus) DeepCopyInto(out *CronJobStatus) {
|
|||||||
in, out := &in.LastScheduleTime, &out.LastScheduleTime
|
in, out := &in.LastScheduleTime, &out.LastScheduleTime
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
|
if in.LastSuccessfulTime != nil {
|
||||||
|
in, out := &in.LastSuccessfulTime, &out.LastSuccessfulTime
|
||||||
|
*out = (*in).DeepCopy()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,10 @@ limitations under the License.
|
|||||||
|
|
||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||||
func (in *CronJob) APILifecycleIntroduced() (major, minor int) {
|
func (in *CronJob) APILifecycleIntroduced() (major, minor int) {
|
||||||
@@ -29,7 +33,13 @@ func (in *CronJob) APILifecycleIntroduced() (major, minor int) {
|
|||||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||||
func (in *CronJob) APILifecycleDeprecated() (major, minor int) {
|
func (in *CronJob) APILifecycleDeprecated() (major, minor int) {
|
||||||
return 1, 22
|
return 1, 21
|
||||||
|
}
|
||||||
|
|
||||||
|
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||||
|
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||||
|
func (in *CronJob) APILifecycleReplacement() schema.GroupVersionKind {
|
||||||
|
return schema.GroupVersionKind{Group: "batch", Version: "v1", Kind: "CronJob"}
|
||||||
}
|
}
|
||||||
|
|
||||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||||
@@ -47,7 +57,13 @@ func (in *CronJobList) APILifecycleIntroduced() (major, minor int) {
|
|||||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||||
func (in *CronJobList) APILifecycleDeprecated() (major, minor int) {
|
func (in *CronJobList) APILifecycleDeprecated() (major, minor int) {
|
||||||
return 1, 22
|
return 1, 21
|
||||||
|
}
|
||||||
|
|
||||||
|
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||||
|
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||||
|
func (in *CronJobList) APILifecycleReplacement() schema.GroupVersionKind {
|
||||||
|
return schema.GroupVersionKind{Group: "batch", Version: "v1", Kind: "CronJobList"}
|
||||||
}
|
}
|
||||||
|
|
||||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||||
|
1591
staging/src/k8s.io/api/testdata/HEAD/batch.v1.CronJob.json
vendored
Normal file
1591
staging/src/k8s.io/api/testdata/HEAD/batch.v1.CronJob.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
staging/src/k8s.io/api/testdata/HEAD/batch.v1.CronJob.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/batch.v1.CronJob.pb
vendored
Normal file
Binary file not shown.
1086
staging/src/k8s.io/api/testdata/HEAD/batch.v1.CronJob.yaml
vendored
Normal file
1086
staging/src/k8s.io/api/testdata/HEAD/batch.v1.CronJob.yaml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1524
staging/src/k8s.io/api/testdata/HEAD/batch.v1.JobTemplate.json
vendored
Normal file
1524
staging/src/k8s.io/api/testdata/HEAD/batch.v1.JobTemplate.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
staging/src/k8s.io/api/testdata/HEAD/batch.v1.JobTemplate.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/batch.v1.JobTemplate.pb
vendored
Normal file
Binary file not shown.
1045
staging/src/k8s.io/api/testdata/HEAD/batch.v1.JobTemplate.yaml
vendored
Normal file
1045
staging/src/k8s.io/api/testdata/HEAD/batch.v1.JobTemplate.yaml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,237 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobApplyConfiguration represents an declarative configuration of the CronJob type for use
|
||||||
|
// with apply.
|
||||||
|
type CronJobApplyConfiguration struct {
|
||||||
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
|
Spec *CronJobSpecApplyConfiguration `json:"spec,omitempty"`
|
||||||
|
Status *CronJobStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJob constructs an declarative configuration of the CronJob type for use with
|
||||||
|
// apply.
|
||||||
|
func CronJob(name, namespace string) *CronJobApplyConfiguration {
|
||||||
|
b := &CronJobApplyConfiguration{}
|
||||||
|
b.WithName(name)
|
||||||
|
b.WithNamespace(namespace)
|
||||||
|
b.WithKind("CronJob")
|
||||||
|
b.WithAPIVersion("batch/v1")
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Kind field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithKind(value string) *CronJobApplyConfiguration {
|
||||||
|
b.Kind = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithAPIVersion(value string) *CronJobApplyConfiguration {
|
||||||
|
b.APIVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithName(value string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithGenerateName(value string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.GenerateName = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithNamespace(value string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Namespace = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSelfLink sets the SelfLink field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the SelfLink field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithSelfLink(value string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.SelfLink = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUID sets the UID field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the UID field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithUID(value types.UID) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.UID = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithResourceVersion(value string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.ResourceVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Generation field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithGeneration(value int64) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Generation = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.CreationTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionGracePeriodSeconds = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||||
|
// overwriting an existing map entries in Labels field with the same key.
|
||||||
|
func (b *CronJobApplyConfiguration) WithLabels(entries map[string]string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Labels == nil && len(entries) > 0 {
|
||||||
|
b.Labels = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Labels[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||||
|
// overwriting an existing map entries in Annotations field with the same key.
|
||||||
|
func (b *CronJobApplyConfiguration) WithAnnotations(entries map[string]string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Annotations == nil && len(entries) > 0 {
|
||||||
|
b.Annotations = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Annotations[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||||
|
func (b *CronJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithOwnerReferences")
|
||||||
|
}
|
||||||
|
b.OwnerReferences = append(b.OwnerReferences, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||||
|
func (b *CronJobApplyConfiguration) WithFinalizers(values ...string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
b.Finalizers = append(b.Finalizers, values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithClusterName sets the ClusterName field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ClusterName field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithClusterName(value string) *CronJobApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.ClusterName = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *CronJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||||
|
if b.ObjectMetaApplyConfiguration == nil {
|
||||||
|
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Spec field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithSpec(value *CronJobSpecApplyConfiguration) *CronJobApplyConfiguration {
|
||||||
|
b.Spec = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
|
func (b *CronJobApplyConfiguration) WithStatus(value *CronJobStatusApplyConfiguration) *CronJobApplyConfiguration {
|
||||||
|
b.Status = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/api/batch/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobSpecApplyConfiguration represents an declarative configuration of the CronJobSpec type for use
|
||||||
|
// with apply.
|
||||||
|
type CronJobSpecApplyConfiguration struct {
|
||||||
|
Schedule *string `json:"schedule,omitempty"`
|
||||||
|
StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty"`
|
||||||
|
ConcurrencyPolicy *v1.ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`
|
||||||
|
Suspend *bool `json:"suspend,omitempty"`
|
||||||
|
JobTemplate *JobTemplateSpecApplyConfiguration `json:"jobTemplate,omitempty"`
|
||||||
|
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"`
|
||||||
|
FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobSpecApplyConfiguration constructs an declarative configuration of the CronJobSpec type for use with
|
||||||
|
// apply.
|
||||||
|
func CronJobSpec() *CronJobSpecApplyConfiguration {
|
||||||
|
return &CronJobSpecApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSchedule sets the Schedule field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Schedule field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithSchedule(value string) *CronJobSpecApplyConfiguration {
|
||||||
|
b.Schedule = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStartingDeadlineSeconds sets the StartingDeadlineSeconds field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the StartingDeadlineSeconds field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithStartingDeadlineSeconds(value int64) *CronJobSpecApplyConfiguration {
|
||||||
|
b.StartingDeadlineSeconds = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithConcurrencyPolicy sets the ConcurrencyPolicy field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ConcurrencyPolicy field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithConcurrencyPolicy(value v1.ConcurrencyPolicy) *CronJobSpecApplyConfiguration {
|
||||||
|
b.ConcurrencyPolicy = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSuspend sets the Suspend field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Suspend field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithSuspend(value bool) *CronJobSpecApplyConfiguration {
|
||||||
|
b.Suspend = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithJobTemplate sets the JobTemplate field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the JobTemplate field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithJobTemplate(value *JobTemplateSpecApplyConfiguration) *CronJobSpecApplyConfiguration {
|
||||||
|
b.JobTemplate = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSuccessfulJobsHistoryLimit sets the SuccessfulJobsHistoryLimit field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the SuccessfulJobsHistoryLimit field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithSuccessfulJobsHistoryLimit(value int32) *CronJobSpecApplyConfiguration {
|
||||||
|
b.SuccessfulJobsHistoryLimit = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithFailedJobsHistoryLimit sets the FailedJobsHistoryLimit field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the FailedJobsHistoryLimit field is set to the value of the last call.
|
||||||
|
func (b *CronJobSpecApplyConfiguration) WithFailedJobsHistoryLimit(value int32) *CronJobSpecApplyConfiguration {
|
||||||
|
b.FailedJobsHistoryLimit = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
v1 "k8s.io/client-go/applyconfigurations/core/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobStatusApplyConfiguration represents an declarative configuration of the CronJobStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type CronJobStatusApplyConfiguration struct {
|
||||||
|
Active []v1.ObjectReferenceApplyConfiguration `json:"active,omitempty"`
|
||||||
|
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
|
||||||
|
LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobStatusApplyConfiguration constructs an declarative configuration of the CronJobStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func CronJobStatus() *CronJobStatusApplyConfiguration {
|
||||||
|
return &CronJobStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithActive adds the given value to the Active field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Active field.
|
||||||
|
func (b *CronJobStatusApplyConfiguration) WithActive(values ...*v1.ObjectReferenceApplyConfiguration) *CronJobStatusApplyConfiguration {
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithActive")
|
||||||
|
}
|
||||||
|
b.Active = append(b.Active, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLastScheduleTime sets the LastScheduleTime field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the LastScheduleTime field is set to the value of the last call.
|
||||||
|
func (b *CronJobStatusApplyConfiguration) WithLastScheduleTime(value metav1.Time) *CronJobStatusApplyConfiguration {
|
||||||
|
b.LastScheduleTime = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLastSuccessfulTime sets the LastSuccessfulTime field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the LastSuccessfulTime field is set to the value of the last call.
|
||||||
|
func (b *CronJobStatusApplyConfiguration) WithLastSuccessfulTime(value metav1.Time) *CronJobStatusApplyConfiguration {
|
||||||
|
b.LastSuccessfulTime = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// JobTemplateSpecApplyConfiguration represents an declarative configuration of the JobTemplateSpec type for use
|
||||||
|
// with apply.
|
||||||
|
type JobTemplateSpecApplyConfiguration struct {
|
||||||
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
|
Spec *JobSpecApplyConfiguration `json:"spec,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// JobTemplateSpecApplyConfiguration constructs an declarative configuration of the JobTemplateSpec type for use with
|
||||||
|
// apply.
|
||||||
|
func JobTemplateSpec() *JobTemplateSpecApplyConfiguration {
|
||||||
|
return &JobTemplateSpecApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithName(value string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithGenerateName(value string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.GenerateName = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithNamespace(value string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Namespace = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSelfLink sets the SelfLink field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the SelfLink field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithSelfLink(value string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.SelfLink = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUID sets the UID field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the UID field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithUID(value types.UID) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.UID = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithResourceVersion(value string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.ResourceVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Generation field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithGeneration(value int64) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Generation = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.CreationTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionGracePeriodSeconds = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||||
|
// overwriting an existing map entries in Labels field with the same key.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Labels == nil && len(entries) > 0 {
|
||||||
|
b.Labels = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Labels[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||||
|
// overwriting an existing map entries in Annotations field with the same key.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Annotations == nil && len(entries) > 0 {
|
||||||
|
b.Annotations = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Annotations[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithOwnerReferences")
|
||||||
|
}
|
||||||
|
b.OwnerReferences = append(b.OwnerReferences, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
b.Finalizers = append(b.Finalizers, values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithClusterName sets the ClusterName field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ClusterName field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithClusterName(value string) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.ClusterName = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||||
|
if b.ObjectMetaApplyConfiguration == nil {
|
||||||
|
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Spec field is set to the value of the last call.
|
||||||
|
func (b *JobTemplateSpecApplyConfiguration) WithSpec(value *JobSpecApplyConfiguration) *JobTemplateSpecApplyConfiguration {
|
||||||
|
b.Spec = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -28,6 +28,7 @@ import (
|
|||||||
type CronJobStatusApplyConfiguration struct {
|
type CronJobStatusApplyConfiguration struct {
|
||||||
Active []v1.ObjectReferenceApplyConfiguration `json:"active,omitempty"`
|
Active []v1.ObjectReferenceApplyConfiguration `json:"active,omitempty"`
|
||||||
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
|
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
|
||||||
|
LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CronJobStatusApplyConfiguration constructs an declarative configuration of the CronJobStatus type for use with
|
// CronJobStatusApplyConfiguration constructs an declarative configuration of the CronJobStatus type for use with
|
||||||
@@ -56,3 +57,11 @@ func (b *CronJobStatusApplyConfiguration) WithLastScheduleTime(value metav1.Time
|
|||||||
b.LastScheduleTime = &value
|
b.LastScheduleTime = &value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithLastSuccessfulTime sets the LastSuccessfulTime field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the LastSuccessfulTime field is set to the value of the last call.
|
||||||
|
func (b *CronJobStatusApplyConfiguration) WithLastSuccessfulTime(value metav1.Time) *CronJobStatusApplyConfiguration {
|
||||||
|
b.LastSuccessfulTime = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
@@ -363,6 +363,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
return &autoscalingv2beta2.ResourceMetricStatusApplyConfiguration{}
|
return &autoscalingv2beta2.ResourceMetricStatusApplyConfiguration{}
|
||||||
|
|
||||||
// Group=batch, Version=v1
|
// Group=batch, Version=v1
|
||||||
|
case batchv1.SchemeGroupVersion.WithKind("CronJob"):
|
||||||
|
return &applyconfigurationsbatchv1.CronJobApplyConfiguration{}
|
||||||
|
case batchv1.SchemeGroupVersion.WithKind("CronJobSpec"):
|
||||||
|
return &applyconfigurationsbatchv1.CronJobSpecApplyConfiguration{}
|
||||||
|
case batchv1.SchemeGroupVersion.WithKind("CronJobStatus"):
|
||||||
|
return &applyconfigurationsbatchv1.CronJobStatusApplyConfiguration{}
|
||||||
case batchv1.SchemeGroupVersion.WithKind("Job"):
|
case batchv1.SchemeGroupVersion.WithKind("Job"):
|
||||||
return &applyconfigurationsbatchv1.JobApplyConfiguration{}
|
return &applyconfigurationsbatchv1.JobApplyConfiguration{}
|
||||||
case batchv1.SchemeGroupVersion.WithKind("JobCondition"):
|
case batchv1.SchemeGroupVersion.WithKind("JobCondition"):
|
||||||
@@ -371,6 +377,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
return &applyconfigurationsbatchv1.JobSpecApplyConfiguration{}
|
return &applyconfigurationsbatchv1.JobSpecApplyConfiguration{}
|
||||||
case batchv1.SchemeGroupVersion.WithKind("JobStatus"):
|
case batchv1.SchemeGroupVersion.WithKind("JobStatus"):
|
||||||
return &applyconfigurationsbatchv1.JobStatusApplyConfiguration{}
|
return &applyconfigurationsbatchv1.JobStatusApplyConfiguration{}
|
||||||
|
case batchv1.SchemeGroupVersion.WithKind("JobTemplateSpec"):
|
||||||
|
return &applyconfigurationsbatchv1.JobTemplateSpecApplyConfiguration{}
|
||||||
|
|
||||||
// Group=batch, Version=v1beta1
|
// Group=batch, Version=v1beta1
|
||||||
case batchv1beta1.SchemeGroupVersion.WithKind("CronJob"):
|
case batchv1beta1.SchemeGroupVersion.WithKind("CronJob"):
|
||||||
|
90
staging/src/k8s.io/client-go/informers/batch/v1/cronjob.go
Normal file
90
staging/src/k8s.io/client-go/informers/batch/v1/cronjob.go
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||||
|
kubernetes "k8s.io/client-go/kubernetes"
|
||||||
|
v1 "k8s.io/client-go/listers/batch/v1"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobInformer provides access to a shared informer and lister for
|
||||||
|
// CronJobs.
|
||||||
|
type CronJobInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1.CronJobLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type cronJobInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCronJobInformer constructs a new informer for CronJob type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredCronJobInformer constructs a new informer for CronJob type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.BatchV1().CronJobs(namespace).List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.BatchV1().CronJobs(namespace).Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&batchv1.CronJob{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *cronJobInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&batchv1.CronJob{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *cronJobInformer) Lister() v1.CronJobLister {
|
||||||
|
return v1.NewCronJobLister(f.Informer().GetIndexer())
|
||||||
|
}
|
@@ -24,6 +24,8 @@ import (
|
|||||||
|
|
||||||
// Interface provides access to all the informers in this group version.
|
// Interface provides access to all the informers in this group version.
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
|
// CronJobs returns a CronJobInformer.
|
||||||
|
CronJobs() CronJobInformer
|
||||||
// Jobs returns a JobInformer.
|
// Jobs returns a JobInformer.
|
||||||
Jobs() JobInformer
|
Jobs() JobInformer
|
||||||
}
|
}
|
||||||
@@ -39,6 +41,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
|||||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CronJobs returns a CronJobInformer.
|
||||||
|
func (v *version) CronJobs() CronJobInformer {
|
||||||
|
return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
// Jobs returns a JobInformer.
|
// Jobs returns a JobInformer.
|
||||||
func (v *version) Jobs() JobInformer {
|
func (v *version) Jobs() JobInformer {
|
||||||
return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
@@ -146,6 +146,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil
|
||||||
|
|
||||||
// Group=batch, Version=v1
|
// Group=batch, Version=v1
|
||||||
|
case batchv1.SchemeGroupVersion.WithResource("cronjobs"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil
|
||||||
case batchv1.SchemeGroupVersion.WithResource("jobs"):
|
case batchv1.SchemeGroupVersion.WithResource("jobs"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
type BatchV1Interface interface {
|
type BatchV1Interface interface {
|
||||||
RESTClient() rest.Interface
|
RESTClient() rest.Interface
|
||||||
|
CronJobsGetter
|
||||||
JobsGetter
|
JobsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +35,10 @@ type BatchV1Client struct {
|
|||||||
restClient rest.Interface
|
restClient rest.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *BatchV1Client) CronJobs(namespace string) CronJobInterface {
|
||||||
|
return newCronJobs(c, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *BatchV1Client) Jobs(namespace string) JobInterface {
|
func (c *BatchV1Client) Jobs(namespace string) JobInterface {
|
||||||
return newJobs(c, namespace)
|
return newJobs(c, namespace)
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,195 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
v1 "k8s.io/api/batch/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobsGetter has a method to return a CronJobInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type CronJobsGetter interface {
|
||||||
|
CronJobs(namespace string) CronJobInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobInterface has methods to work with CronJob resources.
|
||||||
|
type CronJobInterface interface {
|
||||||
|
Create(ctx context.Context, cronJob *v1.CronJob, opts metav1.CreateOptions) (*v1.CronJob, error)
|
||||||
|
Update(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (*v1.CronJob, error)
|
||||||
|
UpdateStatus(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (*v1.CronJob, error)
|
||||||
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CronJob, error)
|
||||||
|
List(ctx context.Context, opts metav1.ListOptions) (*v1.CronJobList, error)
|
||||||
|
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CronJob, err error)
|
||||||
|
CronJobExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// cronJobs implements CronJobInterface
|
||||||
|
type cronJobs struct {
|
||||||
|
client rest.Interface
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
// newCronJobs returns a CronJobs
|
||||||
|
func newCronJobs(c *BatchV1Client, namespace string) *cronJobs {
|
||||||
|
return &cronJobs{
|
||||||
|
client: c.RESTClient(),
|
||||||
|
ns: namespace,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
|
||||||
|
func (c *cronJobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CronJob, err error) {
|
||||||
|
result = &v1.CronJob{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
Name(name).
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
|
||||||
|
func (c *cronJobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CronJobList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
result = &v1.CronJobList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested cronJobs.
|
||||||
|
func (c *cronJobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
opts.Watch = true
|
||||||
|
return c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Watch(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
|
||||||
|
func (c *cronJobs) Create(ctx context.Context, cronJob *v1.CronJob, opts metav1.CreateOptions) (result *v1.CronJob, err error) {
|
||||||
|
result = &v1.CronJob{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(cronJob).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
|
||||||
|
func (c *cronJobs) Update(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) {
|
||||||
|
result = &v1.CronJob{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
Name(cronJob.Name).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(cronJob).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *cronJobs) UpdateStatus(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) {
|
||||||
|
result = &v1.CronJob{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
Name(cronJob.Name).
|
||||||
|
SubResource("status").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(cronJob).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *cronJobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
Name(name).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *cronJobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOpts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched cronJob.
|
||||||
|
func (c *cronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CronJob, err error) {
|
||||||
|
result = &v1.CronJob{}
|
||||||
|
err = c.client.Patch(pt).
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("cronjobs").
|
||||||
|
Name(name).
|
||||||
|
SubResource(subresources...).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(data).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
@@ -28,6 +28,10 @@ type FakeBatchV1 struct {
|
|||||||
*testing.Fake
|
*testing.Fake
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *FakeBatchV1) CronJobs(namespace string) v1.CronJobInterface {
|
||||||
|
return &FakeCronJobs{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface {
|
func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface {
|
||||||
return &FakeJobs{c, namespace}
|
return &FakeJobs{c, namespace}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeCronJobs implements CronJobInterface
|
||||||
|
type FakeCronJobs struct {
|
||||||
|
Fake *FakeBatchV1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var cronjobsResource = schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "cronjobs"}
|
||||||
|
|
||||||
|
var cronjobsKind = schema.GroupVersionKind{Group: "batch", Version: "v1", Kind: "CronJob"}
|
||||||
|
|
||||||
|
// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
|
||||||
|
func (c *FakeCronJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *batchv1.CronJob, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetAction(cronjobsResource, c.ns, name), &batchv1.CronJob{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*batchv1.CronJob), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
|
||||||
|
func (c *FakeCronJobs) List(ctx context.Context, opts v1.ListOptions) (result *batchv1.CronJobList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListAction(cronjobsResource, cronjobsKind, c.ns, opts), &batchv1.CronJobList{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &batchv1.CronJobList{ListMeta: obj.(*batchv1.CronJobList).ListMeta}
|
||||||
|
for _, item := range obj.(*batchv1.CronJobList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested cronJobs.
|
||||||
|
func (c *FakeCronJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchAction(cronjobsResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
|
||||||
|
func (c *FakeCronJobs) Create(ctx context.Context, cronJob *batchv1.CronJob, opts v1.CreateOptions) (result *batchv1.CronJob, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateAction(cronjobsResource, c.ns, cronJob), &batchv1.CronJob{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*batchv1.CronJob), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
|
||||||
|
func (c *FakeCronJobs) Update(ctx context.Context, cronJob *batchv1.CronJob, opts v1.UpdateOptions) (result *batchv1.CronJob, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateAction(cronjobsResource, c.ns, cronJob), &batchv1.CronJob{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*batchv1.CronJob), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakeCronJobs) UpdateStatus(ctx context.Context, cronJob *batchv1.CronJob, opts v1.UpdateOptions) (*batchv1.CronJob, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, cronJob), &batchv1.CronJob{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*batchv1.CronJob), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakeCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteAction(cronjobsResource, c.ns, name), &batchv1.CronJob{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakeCronJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionAction(cronjobsResource, c.ns, listOpts)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &batchv1.CronJobList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched cronJob.
|
||||||
|
func (c *FakeCronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *batchv1.CronJob, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceAction(cronjobsResource, c.ns, name, pt, data, subresources...), &batchv1.CronJob{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*batchv1.CronJob), err
|
||||||
|
}
|
@@ -18,4 +18,6 @@ limitations under the License.
|
|||||||
|
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
|
type CronJobExpansion interface{}
|
||||||
|
|
||||||
type JobExpansion interface{}
|
type JobExpansion interface{}
|
||||||
|
99
staging/src/k8s.io/client-go/listers/batch/v1/cronjob.go
Normal file
99
staging/src/k8s.io/client-go/listers/batch/v1/cronjob.go
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/api/batch/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CronJobLister helps list CronJobs.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type CronJobLister interface {
|
||||||
|
// List lists all CronJobs in the indexer.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v1.CronJob, err error)
|
||||||
|
// CronJobs returns an object that can list and get CronJobs.
|
||||||
|
CronJobs(namespace string) CronJobNamespaceLister
|
||||||
|
CronJobListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// cronJobLister implements the CronJobLister interface.
|
||||||
|
type cronJobLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCronJobLister returns a new CronJobLister.
|
||||||
|
func NewCronJobLister(indexer cache.Indexer) CronJobLister {
|
||||||
|
return &cronJobLister{indexer: indexer}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all CronJobs in the indexer.
|
||||||
|
func (s *cronJobLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) {
|
||||||
|
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v1.CronJob))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobs returns an object that can list and get CronJobs.
|
||||||
|
func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister {
|
||||||
|
return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobNamespaceLister helps list and get CronJobs.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type CronJobNamespaceLister interface {
|
||||||
|
// List lists all CronJobs in the indexer for a given namespace.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v1.CronJob, err error)
|
||||||
|
// Get retrieves the CronJob from the indexer for a given namespace and name.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
Get(name string) (*v1.CronJob, error)
|
||||||
|
CronJobNamespaceListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// cronJobNamespaceLister implements the CronJobNamespaceLister
|
||||||
|
// interface.
|
||||||
|
type cronJobNamespaceLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all CronJobs in the indexer for a given namespace.
|
||||||
|
func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) {
|
||||||
|
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v1.CronJob))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves the CronJob from the indexer for a given namespace and name.
|
||||||
|
func (s cronJobNamespaceLister) Get(name string) (*v1.CronJob, error) {
|
||||||
|
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return nil, errors.NewNotFound(v1.Resource("cronjob"), name)
|
||||||
|
}
|
||||||
|
return obj.(*v1.CronJob), nil
|
||||||
|
}
|
@@ -17,3 +17,11 @@ limitations under the License.
|
|||||||
// Code generated by lister-gen. DO NOT EDIT.
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
|
// CronJobListerExpansion allows custom methods to be added to
|
||||||
|
// CronJobLister.
|
||||||
|
type CronJobListerExpansion interface{}
|
||||||
|
|
||||||
|
// CronJobNamespaceListerExpansion allows custom methods to be added to
|
||||||
|
// CronJobNamespaceLister.
|
||||||
|
type CronJobNamespaceListerExpansion interface{}
|
||||||
|
@@ -177,7 +177,7 @@ func (o *CreateJobOptions) Run() error {
|
|||||||
job = o.createJob()
|
job = o.createJob()
|
||||||
} else {
|
} else {
|
||||||
infos, err := o.Builder.
|
infos, err := o.Builder.
|
||||||
Unstructured().
|
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
|
||||||
NamespaceParam(o.Namespace).DefaultNamespace().
|
NamespaceParam(o.Namespace).DefaultNamespace().
|
||||||
ResourceTypeOrNameArgs(false, o.From).
|
ResourceTypeOrNameArgs(false, o.From).
|
||||||
Flatten().
|
Flatten().
|
||||||
@@ -191,16 +191,14 @@ func (o *CreateJobOptions) Run() error {
|
|||||||
return fmt.Errorf("from must be an existing cronjob")
|
return fmt.Errorf("from must be an existing cronjob")
|
||||||
}
|
}
|
||||||
|
|
||||||
uncastVersionedObj, err := scheme.Scheme.ConvertToVersion(infos[0].Object, batchv1beta1.SchemeGroupVersion)
|
switch obj := infos[0].Object.(type) {
|
||||||
if err != nil {
|
case *batchv1.CronJob:
|
||||||
return fmt.Errorf("from must be an existing cronjob: %v", err)
|
job = o.createJobFromCronJob(obj)
|
||||||
|
case *batchv1beta1.CronJob:
|
||||||
|
job = o.createJobFromCronJobV1Beta1(obj)
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unknown object type %T", obj)
|
||||||
}
|
}
|
||||||
cronJob, ok := uncastVersionedObj.(*batchv1beta1.CronJob)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("from must be an existing cronjob")
|
|
||||||
}
|
|
||||||
|
|
||||||
job = o.createJobFromCronJob(cronJob)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := util.CreateOrUpdateAnnotation(o.CreateAnnotation, job, scheme.DefaultJSONEncoder()); err != nil {
|
if err := util.CreateOrUpdateAnnotation(o.CreateAnnotation, job, scheme.DefaultJSONEncoder()); err != nil {
|
||||||
@@ -256,7 +254,39 @@ func (o *CreateJobOptions) createJob() *batchv1.Job {
|
|||||||
return job
|
return job
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *CreateJobOptions) createJobFromCronJob(cronJob *batchv1beta1.CronJob) *batchv1.Job {
|
func (o *CreateJobOptions) createJobFromCronJobV1Beta1(cronJob *batchv1beta1.CronJob) *batchv1.Job {
|
||||||
|
annotations := make(map[string]string)
|
||||||
|
annotations["cronjob.kubernetes.io/instantiate"] = "manual"
|
||||||
|
for k, v := range cronJob.Spec.JobTemplate.Annotations {
|
||||||
|
annotations[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
job := &batchv1.Job{
|
||||||
|
// this is ok because we know exactly how we want to be serialized
|
||||||
|
TypeMeta: metav1.TypeMeta{APIVersion: batchv1.SchemeGroupVersion.String(), Kind: "Job"},
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: o.Name,
|
||||||
|
Annotations: annotations,
|
||||||
|
Labels: cronJob.Spec.JobTemplate.Labels,
|
||||||
|
OwnerReferences: []metav1.OwnerReference{
|
||||||
|
{
|
||||||
|
// TODO (soltysh): switch this to v1 in v1.22, when n-1 skew will be fulfilled
|
||||||
|
APIVersion: batchv1beta1.SchemeGroupVersion.String(),
|
||||||
|
Kind: "CronJob",
|
||||||
|
Name: cronJob.GetName(),
|
||||||
|
UID: cronJob.GetUID(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Spec: cronJob.Spec.JobTemplate.Spec,
|
||||||
|
}
|
||||||
|
if o.EnforceNamespace {
|
||||||
|
job.Namespace = o.Namespace
|
||||||
|
}
|
||||||
|
return job
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CreateJobOptions) createJobFromCronJob(cronJob *batchv1.CronJob) *batchv1.Job {
|
||||||
annotations := make(map[string]string)
|
annotations := make(map[string]string)
|
||||||
annotations["cronjob.kubernetes.io/instantiate"] = "manual"
|
annotations["cronjob.kubernetes.io/instantiate"] = "manual"
|
||||||
for k, v := range cronJob.Spec.JobTemplate.Annotations {
|
for k, v := range cronJob.Spec.JobTemplate.Annotations {
|
||||||
@@ -273,7 +303,7 @@ func (o *CreateJobOptions) createJobFromCronJob(cronJob *batchv1beta1.CronJob) *
|
|||||||
OwnerReferences: []metav1.OwnerReference{
|
OwnerReferences: []metav1.OwnerReference{
|
||||||
{
|
{
|
||||||
APIVersion: batchv1beta1.SchemeGroupVersion.String(),
|
APIVersion: batchv1beta1.SchemeGroupVersion.String(),
|
||||||
Kind: cronJob.Kind,
|
Kind: "CronJob",
|
||||||
Name: cronJob.GetName(),
|
Name: cronJob.GetName(),
|
||||||
UID: cronJob.GetUID(),
|
UID: cronJob.GetUID(),
|
||||||
},
|
},
|
||||||
|
@@ -135,7 +135,7 @@ func TestCreateJob(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateJobFromCronJob(t *testing.T) {
|
func TestCreateJobFromCronJobV1Beta1(t *testing.T) {
|
||||||
jobName := "test-job"
|
jobName := "test-job"
|
||||||
cronJob := &batchv1beta1.CronJob{
|
cronJob := &batchv1beta1.CronJob{
|
||||||
Spec: batchv1beta1.CronJobSpec{
|
Spec: batchv1beta1.CronJobSpec{
|
||||||
@@ -167,7 +167,73 @@ func TestCreateJobFromCronJob(t *testing.T) {
|
|||||||
OwnerReferences: []metav1.OwnerReference{
|
OwnerReferences: []metav1.OwnerReference{
|
||||||
{
|
{
|
||||||
APIVersion: batchv1beta1.SchemeGroupVersion.String(),
|
APIVersion: batchv1beta1.SchemeGroupVersion.String(),
|
||||||
Kind: cronJob.Kind,
|
Kind: "CronJob",
|
||||||
|
Name: cronJob.GetName(),
|
||||||
|
UID: cronJob.GetUID(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Spec: batchv1.JobSpec{
|
||||||
|
Template: corev1.PodTemplateSpec{
|
||||||
|
Spec: corev1.PodSpec{
|
||||||
|
Containers: []corev1.Container{
|
||||||
|
{Image: "test-image"},
|
||||||
|
},
|
||||||
|
RestartPolicy: corev1.RestartPolicyNever,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, tc := range tests {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
o := &CreateJobOptions{
|
||||||
|
Name: jobName,
|
||||||
|
}
|
||||||
|
job := o.createJobFromCronJobV1Beta1(tc.from)
|
||||||
|
|
||||||
|
if !apiequality.Semantic.DeepEqual(job, tc.expected) {
|
||||||
|
t.Errorf("expected:\n%#v\ngot:\n%#v", tc.expected, job)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateJobFromCronJob(t *testing.T) {
|
||||||
|
jobName := "test-job"
|
||||||
|
cronJob := &batchv1.CronJob{
|
||||||
|
Spec: batchv1.CronJobSpec{
|
||||||
|
JobTemplate: batchv1.JobTemplateSpec{
|
||||||
|
Spec: batchv1.JobSpec{
|
||||||
|
Template: corev1.PodTemplateSpec{
|
||||||
|
Spec: corev1.PodSpec{
|
||||||
|
Containers: []corev1.Container{
|
||||||
|
{Image: "test-image"},
|
||||||
|
},
|
||||||
|
RestartPolicy: corev1.RestartPolicyNever,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
tests := map[string]struct {
|
||||||
|
from *batchv1.CronJob
|
||||||
|
expected *batchv1.Job
|
||||||
|
}{
|
||||||
|
"from CronJob": {
|
||||||
|
from: cronJob,
|
||||||
|
expected: &batchv1.Job{
|
||||||
|
TypeMeta: metav1.TypeMeta{APIVersion: batchv1.SchemeGroupVersion.String(), Kind: "Job"},
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: jobName,
|
||||||
|
Annotations: map[string]string{"cronjob.kubernetes.io/instantiate": "manual"},
|
||||||
|
OwnerReferences: []metav1.OwnerReference{
|
||||||
|
{
|
||||||
|
APIVersion: batchv1beta1.SchemeGroupVersion.String(),
|
||||||
|
Kind: "CronJob",
|
||||||
Name: cronJob.GetName(),
|
Name: cronJob.GetName(),
|
||||||
UID: cronJob.GetUID(),
|
UID: cronJob.GetUID(),
|
||||||
},
|
},
|
||||||
|
@@ -30,7 +30,7 @@ import (
|
|||||||
|
|
||||||
var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "testdata", "openapi", "swagger.json")}
|
var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "testdata", "openapi", "swagger.json")}
|
||||||
|
|
||||||
var _ = Describe("Reading apps/v1beta1/Deployment from openAPIData", func() {
|
var _ = Describe("Reading apps/v1/Deployment from openAPIData", func() {
|
||||||
var resources openapi.Resources
|
var resources openapi.Resources
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
s, err := fakeSchema.OpenAPISchema()
|
s, err := fakeSchema.OpenAPISchema()
|
||||||
@@ -41,7 +41,7 @@ var _ = Describe("Reading apps/v1beta1/Deployment from openAPIData", func() {
|
|||||||
|
|
||||||
gvk := schema.GroupVersionKind{
|
gvk := schema.GroupVersionKind{
|
||||||
Kind: "Deployment",
|
Kind: "Deployment",
|
||||||
Version: "v1beta1",
|
Version: "v1",
|
||||||
Group: "apps",
|
Group: "apps",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
50696
staging/src/k8s.io/kubectl/testdata/openapi/swagger.json
vendored
50696
staging/src/k8s.io/kubectl/testdata/openapi/swagger.json
vendored
File diff suppressed because it is too large
Load Diff
@@ -51,8 +51,8 @@ var statusData = map[schema.GroupVersionResource]string{
|
|||||||
gvr("networking.k8s.io", "v1beta1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
gvr("networking.k8s.io", "v1beta1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
||||||
gvr("networking.k8s.io", "v1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
gvr("networking.k8s.io", "v1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
||||||
gvr("autoscaling", "v1", "horizontalpodautoscalers"): `{"status": {"currentReplicas": 5}}`,
|
gvr("autoscaling", "v1", "horizontalpodautoscalers"): `{"status": {"currentReplicas": 5}}`,
|
||||||
|
gvr("batch", "v1", "cronjobs"): `{"status": {"lastScheduleTime": null}}`,
|
||||||
gvr("batch", "v1beta1", "cronjobs"): `{"status": {"lastScheduleTime": null}}`,
|
gvr("batch", "v1beta1", "cronjobs"): `{"status": {"lastScheduleTime": null}}`,
|
||||||
gvr("batch", "v2alpha1", "cronjobs"): `{"status": {"lastScheduleTime": null}}`,
|
|
||||||
gvr("storage.k8s.io", "v1", "volumeattachments"): `{"status": {"attached": true}}`,
|
gvr("storage.k8s.io", "v1", "volumeattachments"): `{"status": {"attached": true}}`,
|
||||||
gvr("policy", "v1beta1", "poddisruptionbudgets"): `{"status": {"currentHealthy": 5}}`,
|
gvr("policy", "v1beta1", "poddisruptionbudgets"): `{"status": {"currentHealthy": 5}}`,
|
||||||
gvr("certificates.k8s.io", "v1beta1", "certificatesigningrequests"): `{"status": {"conditions": [{"type": "MyStatus"}]}}`,
|
gvr("certificates.k8s.io", "v1beta1", "certificatesigningrequests"): `{"status": {"conditions": [{"type": "MyStatus"}]}}`,
|
||||||
|
@@ -152,6 +152,13 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
|
|||||||
Stub: `{"metadata": {"name": "job1"}, "spec": {"manualSelector": true, "selector": {"matchLabels": {"controller-uid": "uid1"}}, "template": {"metadata": {"labels": {"controller-uid": "uid1"}}, "spec": {"containers": [{"image": "` + image + `", "name": "container1"}], "dnsPolicy": "ClusterFirst", "restartPolicy": "Never"}}}}`,
|
Stub: `{"metadata": {"name": "job1"}, "spec": {"manualSelector": true, "selector": {"matchLabels": {"controller-uid": "uid1"}}, "template": {"metadata": {"labels": {"controller-uid": "uid1"}}, "spec": {"containers": [{"image": "` + image + `", "name": "container1"}], "dnsPolicy": "ClusterFirst", "restartPolicy": "Never"}}}}`,
|
||||||
ExpectedEtcdPath: "/registry/jobs/" + namespace + "/job1",
|
ExpectedEtcdPath: "/registry/jobs/" + namespace + "/job1",
|
||||||
},
|
},
|
||||||
|
gvr("batch", "v1", "cronjobs"): {
|
||||||
|
Stub: `{"metadata": {"name": "cjv1"}, "spec": {"jobTemplate": {"spec": {"template": {"metadata": {"labels": {"controller-uid": "uid0"}}, "spec": {"containers": [{"image": "` + image + `", "name": "container0"}], "dnsPolicy": "ClusterFirst", "restartPolicy": "Never"}}}}, "schedule": "* * * * *"}}`,
|
||||||
|
ExpectedEtcdPath: "/registry/cronjobs/" + namespace + "/cjv1",
|
||||||
|
// TODO (soltysh): in 1.22 this should be switched to v1. See https://github.com/kubernetes/kubernetes/pull/98965
|
||||||
|
// this has to stay at v1beta1 for a release, otherwise a 1.20 API server won't be able to read the data persisted in etcd and will break during a multi-server upgrade
|
||||||
|
ExpectedGVK: gvkP("batch", "v1beta1", "CronJob"),
|
||||||
|
},
|
||||||
// --
|
// --
|
||||||
|
|
||||||
// k8s.io/kubernetes/pkg/apis/batch/v1beta1
|
// k8s.io/kubernetes/pkg/apis/batch/v1beta1
|
||||||
|
Reference in New Issue
Block a user