diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 96213ac8549c..cb32a9f27408 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -3685,6 +3685,10 @@ "description": "The number of pods which reached phase Succeeded.", "format": "int32", "type": "integer" + }, + "uncountedTerminatedPods": { + "$ref": "#/definitions/io.k8s.api.batch.v1.UncountedTerminatedPods", + "description": "UncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status: (1) Add the pod UID to the arrays in this field. (2) Remove the pod finalizer. (3) Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nThis field is alpha-level. The job controller only makes use of this field when the feature gate PodTrackingWithFinalizers is enabled. Old jobs might not be tracked using this field, in which case the field remains null." } }, "type": "object" @@ -3703,6 +3707,28 @@ }, "type": "object" }, + "io.k8s.api.batch.v1.UncountedTerminatedPods": { + "description": "UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't been accounted in Job status counters.", + "properties": { + "failed": { + "description": "Failed holds UIDs of failed Pods.", + "items": { + "type": "string" + }, + "type": "array", + "x-kubernetes-list-type": "set" + }, + "succeeded": { + "description": "Succeeded holds UIDs of succeeded Pods.", + "items": { + "type": "string" + }, + "type": "array", + "x-kubernetes-list-type": "set" + } + }, + "type": "object" + }, "io.k8s.api.batch.v1beta1.CronJob": { "description": "CronJob represents the configuration of a single cron job.", "properties": { diff --git a/pkg/apis/batch/types.go b/pkg/apis/batch/types.go index 83022e723511..e963de5e9e1f 100644 --- a/pkg/apis/batch/types.go +++ b/pkg/apis/batch/types.go @@ -18,9 +18,18 @@ package batch import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" api "k8s.io/kubernetes/pkg/apis/core" ) +// JobTrackingFinalizer is a finalizer for Job's pods. It prevents them from +// being deleted before being accounted in the Job status. +// The apiserver and job controller use this string as a Job annotation, to +// mark Jobs that are being tracked using pod finalizers. Two releases after +// the JobTrackingWithFinalizers graduates to GA, JobTrackingFinalizer will +// no longer be used as a Job annotation. +const JobTrackingFinalizer = "batch.kubernetes.io/job-tracking" + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // Job represents the configuration of a single job. @@ -255,6 +264,38 @@ type JobStatus struct { // represented as "1,3-5,7". // +optional CompletedIndexes string + + // UncountedTerminatedPods holds the UIDs of Pods that have terminated but + // the job controller hasn't yet accounted for in the status counters. + // + // The job controller creates pods with a finalizer. When a pod terminates + // (succeeded or failed), the controller does three steps to account for it + // in the job status: + // (1) Add the pod UID to the corresponding array in this field. + // (2) Remove the pod finalizer. + // (3) Remove the pod UID from the array while increasing the corresponding + // counter. + // + // This field is alpha-level. The job controller only makes use of this field + // when the feature gate PodTrackingWithFinalizers is enabled. + // Old jobs might not be tracked using this field, in which case the field + // remains null. + // +optional + UncountedTerminatedPods *UncountedTerminatedPods +} + +// UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't +// been accounted in Job status counters. +type UncountedTerminatedPods struct { + // Succeeded holds UIDs of succeeded Pods. + // +listType=set + // +optional + Succeeded []types.UID + + // Failed holds UIDs of failed Pods. + // +listType=set + // +optional + Failed []types.UID } // JobConditionType is a valid value for JobCondition.Type diff --git a/pkg/apis/batch/v1/zz_generated.conversion.go b/pkg/apis/batch/v1/zz_generated.conversion.go index eb72b8b8087a..ec49633b55e6 100644 --- a/pkg/apis/batch/v1/zz_generated.conversion.go +++ b/pkg/apis/batch/v1/zz_generated.conversion.go @@ -28,6 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" batch "k8s.io/kubernetes/pkg/apis/batch" core "k8s.io/kubernetes/pkg/apis/core" apiscorev1 "k8s.io/kubernetes/pkg/apis/core/v1" @@ -130,6 +131,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*v1.UncountedTerminatedPods)(nil), (*batch.UncountedTerminatedPods)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_UncountedTerminatedPods_To_batch_UncountedTerminatedPods(a.(*v1.UncountedTerminatedPods), b.(*batch.UncountedTerminatedPods), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*batch.UncountedTerminatedPods)(nil), (*v1.UncountedTerminatedPods)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_batch_UncountedTerminatedPods_To_v1_UncountedTerminatedPods(a.(*batch.UncountedTerminatedPods), b.(*v1.UncountedTerminatedPods), scope) + }); err != nil { + return err + } 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) }); err != nil { @@ -421,6 +432,7 @@ func autoConvert_v1_JobStatus_To_batch_JobStatus(in *v1.JobStatus, out *batch.Jo out.Succeeded = in.Succeeded out.Failed = in.Failed out.CompletedIndexes = in.CompletedIndexes + out.UncountedTerminatedPods = (*batch.UncountedTerminatedPods)(unsafe.Pointer(in.UncountedTerminatedPods)) return nil } @@ -437,6 +449,7 @@ func autoConvert_batch_JobStatus_To_v1_JobStatus(in *batch.JobStatus, out *v1.Jo out.Succeeded = in.Succeeded out.Failed = in.Failed out.CompletedIndexes = in.CompletedIndexes + out.UncountedTerminatedPods = (*v1.UncountedTerminatedPods)(unsafe.Pointer(in.UncountedTerminatedPods)) return nil } @@ -470,3 +483,25 @@ func autoConvert_batch_JobTemplateSpec_To_v1_JobTemplateSpec(in *batch.JobTempla 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) } + +func autoConvert_v1_UncountedTerminatedPods_To_batch_UncountedTerminatedPods(in *v1.UncountedTerminatedPods, out *batch.UncountedTerminatedPods, s conversion.Scope) error { + out.Succeeded = *(*[]types.UID)(unsafe.Pointer(&in.Succeeded)) + out.Failed = *(*[]types.UID)(unsafe.Pointer(&in.Failed)) + return nil +} + +// Convert_v1_UncountedTerminatedPods_To_batch_UncountedTerminatedPods is an autogenerated conversion function. +func Convert_v1_UncountedTerminatedPods_To_batch_UncountedTerminatedPods(in *v1.UncountedTerminatedPods, out *batch.UncountedTerminatedPods, s conversion.Scope) error { + return autoConvert_v1_UncountedTerminatedPods_To_batch_UncountedTerminatedPods(in, out, s) +} + +func autoConvert_batch_UncountedTerminatedPods_To_v1_UncountedTerminatedPods(in *batch.UncountedTerminatedPods, out *v1.UncountedTerminatedPods, s conversion.Scope) error { + out.Succeeded = *(*[]types.UID)(unsafe.Pointer(&in.Succeeded)) + out.Failed = *(*[]types.UID)(unsafe.Pointer(&in.Failed)) + return nil +} + +// Convert_batch_UncountedTerminatedPods_To_v1_UncountedTerminatedPods is an autogenerated conversion function. +func Convert_batch_UncountedTerminatedPods_To_v1_UncountedTerminatedPods(in *batch.UncountedTerminatedPods, out *v1.UncountedTerminatedPods, s conversion.Scope) error { + return autoConvert_batch_UncountedTerminatedPods_To_v1_UncountedTerminatedPods(in, out, s) +} diff --git a/pkg/apis/batch/validation/validation.go b/pkg/apis/batch/validation/validation.go index 5d26d0dc604a..dc8aaaecf538 100644 --- a/pkg/apis/batch/validation/validation.go +++ b/pkg/apis/batch/validation/validation.go @@ -20,10 +20,10 @@ import ( "fmt" "github.com/robfig/cron/v3" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" unversionedvalidation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/sets" apimachineryvalidation "k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/kubernetes/pkg/apis/batch" @@ -83,11 +83,14 @@ func ValidateGeneratedSelector(obj *batch.Job) field.ErrorList { } // ValidateJob validates a Job and returns an ErrorList with any errors. -func ValidateJob(job *batch.Job, opts apivalidation.PodValidationOptions) field.ErrorList { +func ValidateJob(job *batch.Job, opts JobValidationOptions) field.ErrorList { // Jobs and rcs have the same name validation allErrs := apivalidation.ValidateObjectMeta(&job.ObjectMeta, true, apivalidation.ValidateReplicationControllerName, field.NewPath("metadata")) allErrs = append(allErrs, ValidateGeneratedSelector(job)...) - allErrs = append(allErrs, ValidateJobSpec(&job.Spec, field.NewPath("spec"), opts)...) + allErrs = append(allErrs, ValidateJobSpec(&job.Spec, field.NewPath("spec"), opts.PodValidationOptions)...) + if !opts.AllowTrackingAnnotation && hasJobTrackingAnnotation(job) { + allErrs = append(allErrs, field.Forbidden(field.NewPath("metadata").Child("annotations").Key(batch.JobTrackingFinalizer), "cannot add this annotation")) + } if job.Spec.CompletionMode != nil && *job.Spec.CompletionMode == batch.IndexedCompletion && job.Spec.Completions != nil && *job.Spec.Completions > 0 { // For indexed job, the job controller appends a suffix (`-$INDEX`) // to the pod hostname when indexed job create pods. @@ -101,6 +104,14 @@ func ValidateJob(job *batch.Job, opts apivalidation.PodValidationOptions) field. return allErrs } +func hasJobTrackingAnnotation(job *batch.Job) bool { + if job.Annotations == nil { + return false + } + _, ok := job.Annotations[batch.JobTrackingFinalizer] + return ok +} + // ValidateJobSpec validates a JobSpec and returns an ErrorList with any errors. func ValidateJobSpec(spec *batch.JobSpec, fldPath *field.Path, opts apivalidation.PodValidationOptions) field.ErrorList { allErrs := validateJobSpec(spec, fldPath, opts) @@ -169,12 +180,36 @@ func validateJobSpec(spec *batch.JobSpec, fldPath *field.Path, opts apivalidatio return allErrs } -// ValidateJobStatus validates a JobStatus and returns an ErrorList with any errors. -func ValidateJobStatus(status *batch.JobStatus, fldPath *field.Path) field.ErrorList { +// validateJobStatus validates a JobStatus and returns an ErrorList with any errors. +func validateJobStatus(status *batch.JobStatus, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Active), fldPath.Child("active"))...) allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Succeeded), fldPath.Child("succeeded"))...) allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Failed), fldPath.Child("failed"))...) + if status.UncountedTerminatedPods != nil { + path := fldPath.Child("uncountedTerminatedPods") + seen := sets.NewString() + for i, k := range status.UncountedTerminatedPods.Succeeded { + p := path.Child("succeeded").Index(i) + if k == "" { + allErrs = append(allErrs, field.Invalid(p, k, "must not be empty")) + } else if seen.Has(string(k)) { + allErrs = append(allErrs, field.Duplicate(p, k)) + } else { + seen.Insert(string(k)) + } + } + for i, k := range status.UncountedTerminatedPods.Failed { + p := path.Child("failed").Index(i) + if k == "" { + allErrs = append(allErrs, field.Invalid(p, k, "must not be empty")) + } else if seen.Has(string(k)) { + allErrs = append(allErrs, field.Duplicate(p, k)) + } else { + seen.Insert(string(k)) + } + } + } return allErrs } @@ -206,7 +241,7 @@ func ValidateJobSpecUpdate(spec, oldSpec batch.JobSpec, fldPath *field.Path, opt // ValidateJobStatusUpdate validates an update to a JobStatus and returns an ErrorList with any errors. func ValidateJobStatusUpdate(status, oldStatus batch.JobStatus) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, ValidateJobStatus(&status, field.NewPath("status"))...) + allErrs = append(allErrs, validateJobStatus(&status, field.NewPath("status"))...) return allErrs } @@ -306,3 +341,9 @@ func ValidateJobTemplateSpec(spec *batch.JobTemplateSpec, fldPath *field.Path, o } return allErrs } + +type JobValidationOptions struct { + apivalidation.PodValidationOptions + // Allow Job to have the annotation batch.kubernetes.io/job-tracking + AllowTrackingAnnotation bool +} diff --git a/pkg/apis/batch/validation/validation_test.go b/pkg/apis/batch/validation/validation_test.go index 12dd1d960d66..2354acf13dfa 100644 --- a/pkg/apis/batch/validation/validation_test.go +++ b/pkg/apis/batch/validation/validation_test.go @@ -33,6 +33,8 @@ import ( "k8s.io/utils/pointer" ) +var ignoreErrValueDetail = cmpopts.IgnoreFields(field.Error{}, "BadValue", "Detail") + func getValidManualSelector() *metav1.LabelSelector { return &metav1.LabelSelector{ MatchLabels: map[string]string{"a": "b"}, @@ -77,60 +79,91 @@ func TestValidateJob(t *testing.T) { validGeneratedSelector := getValidGeneratedSelector() validPodTemplateSpecForGenerated := getValidPodTemplateSpecForGenerated(validGeneratedSelector) - successCases := map[string]batch.Job{ + successCases := map[string]struct { + opts JobValidationOptions + job batch.Job + }{ "valid manual selector": { - ObjectMeta: metav1.ObjectMeta{ - Name: "myjob", - Namespace: metav1.NamespaceDefault, - UID: types.UID("1a2b3c"), - }, - Spec: batch.JobSpec{ - Selector: validManualSelector, - ManualSelector: pointer.BoolPtr(true), - Template: validPodTemplateSpecForManual, + job: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + UID: types.UID("1a2b3c"), + Annotations: map[string]string{"foo": "bar"}, + }, + Spec: batch.JobSpec{ + Selector: validManualSelector, + ManualSelector: pointer.BoolPtr(true), + Template: validPodTemplateSpecForManual, + }, }, }, "valid generated selector": { - ObjectMeta: metav1.ObjectMeta{ - Name: "myjob", - Namespace: metav1.NamespaceDefault, - UID: types.UID("1a2b3c"), - }, - Spec: batch.JobSpec{ - Selector: validGeneratedSelector, - Template: validPodTemplateSpecForGenerated, + job: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + UID: types.UID("1a2b3c"), + }, + Spec: batch.JobSpec{ + Selector: validGeneratedSelector, + Template: validPodTemplateSpecForGenerated, + }, }, }, "valid NonIndexed completion mode": { - ObjectMeta: metav1.ObjectMeta{ - Name: "myjob", - Namespace: metav1.NamespaceDefault, - UID: types.UID("1a2b3c"), - }, - Spec: batch.JobSpec{ - Selector: validGeneratedSelector, - Template: validPodTemplateSpecForGenerated, - CompletionMode: completionModePtr(batch.NonIndexedCompletion), + job: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + UID: types.UID("1a2b3c"), + }, + Spec: batch.JobSpec{ + Selector: validGeneratedSelector, + Template: validPodTemplateSpecForGenerated, + CompletionMode: completionModePtr(batch.NonIndexedCompletion), + }, }, }, "valid Indexed completion mode": { - ObjectMeta: metav1.ObjectMeta{ - Name: "myjob", - Namespace: metav1.NamespaceDefault, - UID: types.UID("1a2b3c"), + job: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + UID: types.UID("1a2b3c"), + }, + Spec: batch.JobSpec{ + Selector: validGeneratedSelector, + Template: validPodTemplateSpecForGenerated, + CompletionMode: completionModePtr(batch.IndexedCompletion), + Completions: pointer.Int32Ptr(2), + Parallelism: pointer.Int32Ptr(100000), + }, }, - Spec: batch.JobSpec{ - Selector: validGeneratedSelector, - Template: validPodTemplateSpecForGenerated, - CompletionMode: completionModePtr(batch.IndexedCompletion), - Completions: pointer.Int32Ptr(2), - Parallelism: pointer.Int32Ptr(100000), + }, + "valid job tracking annotation": { + opts: JobValidationOptions{ + AllowTrackingAnnotation: true, + }, + job: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + UID: types.UID("1a2b3c"), + Annotations: map[string]string{ + batch.JobTrackingFinalizer: "", + }, + }, + Spec: batch.JobSpec{ + Selector: validGeneratedSelector, + Template: validPodTemplateSpecForGenerated, + }, }, }, } for k, v := range successCases { t.Run(k, func(t *testing.T) { - if errs := ValidateJob(&v, corevalidation.PodValidationOptions{}); len(errs) != 0 { + if errs := ValidateJob(&v.job, v.opts); len(errs) != 0 { t.Errorf("Got unexpected validation errors: %v", errs) } }) @@ -306,11 +339,25 @@ func TestValidateJob(t *testing.T) { Parallelism: pointer.Int32Ptr(100001), }, }, + "metadata.annotations[batch.kubernetes.io/job-tracking]: cannot add this annotation": { + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + UID: types.UID("1a2b3c"), + Annotations: map[string]string{ + batch.JobTrackingFinalizer: "", + }, + }, + Spec: batch.JobSpec{ + Selector: validGeneratedSelector, + Template: validPodTemplateSpecForGenerated, + }, + }, } for k, v := range errorCases { t.Run(k, func(t *testing.T) { - errs := ValidateJob(&v, corevalidation.PodValidationOptions{}) + errs := ValidateJob(&v, JobValidationOptions{}) if len(errs) == 0 { t.Errorf("expected failure for %s", k) } else { @@ -436,15 +483,18 @@ func TestValidateJobUpdate(t *testing.T) { } func TestValidateJobUpdateStatus(t *testing.T) { - type testcase struct { - old batch.Job - update batch.Job - } - - successCases := []testcase{ - { + cases := map[string]struct { + old batch.Job + update batch.Job + wantErrs field.ErrorList + }{ + "valid": { old: batch.Job{ - ObjectMeta: metav1.ObjectMeta{Name: "abc", Namespace: metav1.NamespaceDefault}, + ObjectMeta: metav1.ObjectMeta{ + Name: "abc", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "1", + }, Status: batch.JobStatus{ Active: 1, Succeeded: 2, @@ -452,7 +502,11 @@ func TestValidateJobUpdateStatus(t *testing.T) { }, }, update: batch.Job{ - ObjectMeta: metav1.ObjectMeta{Name: "abc", Namespace: metav1.NamespaceDefault}, + ObjectMeta: metav1.ObjectMeta{ + Name: "abc", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "1", + }, Status: batch.JobStatus{ Active: 1, Succeeded: 1, @@ -460,18 +514,7 @@ func TestValidateJobUpdateStatus(t *testing.T) { }, }, }, - } - - for _, successCase := range successCases { - successCase.old.ObjectMeta.ResourceVersion = "1" - successCase.update.ObjectMeta.ResourceVersion = "1" - if errs := ValidateJobUpdateStatus(&successCase.update, &successCase.old); len(errs) != 0 { - t.Errorf("expected success: %v", errs) - } - } - - errorCases := map[string]testcase{ - "[status.active: Invalid value: -1: must be greater than or equal to 0, status.succeeded: Invalid value: -2: must be greater than or equal to 0]": { + "negative counts": { old: batch.Job{ ObjectMeta: metav1.ObjectMeta{ Name: "abc", @@ -496,18 +539,48 @@ func TestValidateJobUpdateStatus(t *testing.T) { Failed: 3, }, }, + wantErrs: field.ErrorList{ + {Type: field.ErrorTypeInvalid, Field: "status.active"}, + {Type: field.ErrorTypeInvalid, Field: "status.succeeded"}, + }, + }, + "empty and duplicated uncounted pods": { + old: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "abc", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "5", + }, + }, + update: batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "abc", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "5", + }, + Status: batch.JobStatus{ + UncountedTerminatedPods: &batch.UncountedTerminatedPods{ + Succeeded: []types.UID{"a", "b", "c", "a", ""}, + Failed: []types.UID{"c", "d", "e", "d", ""}, + }, + }, + }, + wantErrs: field.ErrorList{ + {Type: field.ErrorTypeDuplicate, Field: "status.uncountedTerminatedPods.succeeded[3]"}, + {Type: field.ErrorTypeInvalid, Field: "status.uncountedTerminatedPods.succeeded[4]"}, + {Type: field.ErrorTypeDuplicate, Field: "status.uncountedTerminatedPods.failed[0]"}, + {Type: field.ErrorTypeDuplicate, Field: "status.uncountedTerminatedPods.failed[3]"}, + {Type: field.ErrorTypeInvalid, Field: "status.uncountedTerminatedPods.failed[4]"}, + }, }, } - - for testName, errorCase := range errorCases { - errs := ValidateJobUpdateStatus(&errorCase.update, &errorCase.old) - if len(errs) == 0 { - t.Errorf("expected failure: %s", testName) - continue - } - if errs.ToAggregate().Error() != testName { - t.Errorf("expected '%s' got '%s'", errs.ToAggregate().Error(), testName) - } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + errs := ValidateJobUpdateStatus(&tc.update, &tc.old) + if diff := cmp.Diff(tc.wantErrs, errs, ignoreErrValueDetail); diff != "" { + t.Errorf("Unexpected errors (-want,+got):\n%s", diff) + } + }) } } diff --git a/pkg/apis/batch/zz_generated.deepcopy.go b/pkg/apis/batch/zz_generated.deepcopy.go index 4c414b2f6119..8b737c71ddb1 100644 --- a/pkg/apis/batch/zz_generated.deepcopy.go +++ b/pkg/apis/batch/zz_generated.deepcopy.go @@ -23,6 +23,7 @@ package batch import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" core "k8s.io/kubernetes/pkg/apis/core" ) @@ -312,6 +313,11 @@ func (in *JobStatus) DeepCopyInto(out *JobStatus) { in, out := &in.CompletionTime, &out.CompletionTime *out = (*in).DeepCopy() } + if in.UncountedTerminatedPods != nil { + in, out := &in.UncountedTerminatedPods, &out.UncountedTerminatedPods + *out = new(UncountedTerminatedPods) + (*in).DeepCopyInto(*out) + } return } @@ -369,3 +375,29 @@ func (in *JobTemplateSpec) DeepCopy() *JobTemplateSpec { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UncountedTerminatedPods) DeepCopyInto(out *UncountedTerminatedPods) { + *out = *in + if in.Succeeded != nil { + in, out := &in.Succeeded, &out.Succeeded + *out = make([]types.UID, len(*in)) + copy(*out, *in) + } + if in.Failed != nil { + in, out := &in.Failed, &out.Failed + *out = make([]types.UID, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UncountedTerminatedPods. +func (in *UncountedTerminatedPods) DeepCopy() *UncountedTerminatedPods { + if in == nil { + return nil + } + out := new(UncountedTerminatedPods) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/certificates/validation/validation_test.go b/pkg/apis/certificates/validation/validation_test.go index 477891914c11..32cade470706 100644 --- a/pkg/apis/certificates/validation/validation_test.go +++ b/pkg/apis/certificates/validation/validation_test.go @@ -193,7 +193,6 @@ func TestValidateCertificateSigningRequestCreate(t *testing.T) { SignerName: "example.com/some-signer-name", }, }, - errs: field.ErrorList{}, }, "signerName with a total length greater than 571 characters should be rejected": { csr: capi.CertificateSigningRequest{ @@ -232,7 +231,6 @@ func TestValidateCertificateSigningRequestCreate(t *testing.T) { SignerName: fmt.Sprintf("abc.io/%s.%s", repeatString("a", 253), repeatString("a", 253)), }, }, - errs: field.ErrorList{}, }, "signerName with a domain label greater than 63 characters will fail": { csr: capi.CertificateSigningRequest{ @@ -263,7 +261,6 @@ func TestValidateCertificateSigningRequestCreate(t *testing.T) { SignerName: maxLengthSignerName, }, }, - errs: field.ErrorList{}, }, "negative duration": { csr: capi.CertificateSigningRequest{ @@ -331,7 +328,6 @@ func TestValidateCertificateSigningRequestCreate(t *testing.T) { ExpirationSeconds: csr.DurationToExpirationSeconds(10 * time.Minute), }, }, - errs: field.ErrorList{}, }, "missing usages": { csr: capi.CertificateSigningRequest{ @@ -356,7 +352,6 @@ func TestValidateCertificateSigningRequestCreate(t *testing.T) { SignerName: validSignerName, }, }, - errs: field.ErrorList{}, }, "unknown and duplicate usages - v1": { gv: schema.GroupVersion{Group: capi.SchemeGroupVersion.Group, Version: "v1"}, diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 7f32ad1db5ac..884e6e9a32b1 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -264,6 +264,15 @@ const ( // Allows Job controller to manage Pod completions per completion index. IndexedJob featuregate.Feature = "IndexedJob" + // owner: @alculquicondor + // alpha: v1.22 + // + // Track Job completion without relying on Pod remaining in the cluster + // indefinitely. Pod finalizers, in addition to a field in the Job status + // allow the Job controller to keep track of Pods that it didn't account for + // yet. + JobTrackingWithFinalizers featuregate.Feature = "JobTrackingWithFinalizers" + // owner: @dashpole // alpha: v1.13 // beta: v1.15 @@ -818,6 +827,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS ProcMountType: {Default: false, PreRelease: featuregate.Alpha}, TTLAfterFinished: {Default: true, PreRelease: featuregate.Beta}, IndexedJob: {Default: true, PreRelease: featuregate.Beta}, + JobTrackingWithFinalizers: {Default: false, PreRelease: featuregate.Alpha}, KubeletPodResources: {Default: true, PreRelease: featuregate.Beta}, LocalStorageCapacityIsolationFSQuotaMonitoring: {Default: false, PreRelease: featuregate.Alpha}, NonPreemptingPriority: {Default: true, PreRelease: featuregate.Beta}, diff --git a/pkg/registry/apps/daemonset/strategy_test.go b/pkg/registry/apps/daemonset/strategy_test.go index d5e30ec230ca..dfc30e2866cd 100644 --- a/pkg/registry/apps/daemonset/strategy_test.go +++ b/pkg/registry/apps/daemonset/strategy_test.go @@ -149,7 +149,7 @@ func TestSelectorImmutability(t *testing.T) { }, map[string]string{"a": "b"}, map[string]string{"c": "d"}, - field.ErrorList{}, + nil, }, } diff --git a/pkg/registry/apps/replicaset/strategy_test.go b/pkg/registry/apps/replicaset/strategy_test.go index 2c2994af768e..b136d7d98bc2 100644 --- a/pkg/registry/apps/replicaset/strategy_test.go +++ b/pkg/registry/apps/replicaset/strategy_test.go @@ -187,7 +187,7 @@ func TestSelectorImmutability(t *testing.T) { }, map[string]string{"a": "b"}, map[string]string{"c": "d"}, - field.ErrorList{}, + nil, }, } diff --git a/pkg/registry/batch/job/strategy.go b/pkg/registry/batch/job/strategy.go index ead85e8ffd16..6aedbd1b4529 100644 --- a/pkg/registry/batch/job/strategy.go +++ b/pkg/registry/batch/job/strategy.go @@ -39,6 +39,7 @@ import ( "k8s.io/kubernetes/pkg/api/pod" "k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch/validation" + "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/features" "sigs.k8s.io/structured-merge-diff/v4/fieldpath" ) @@ -104,9 +105,36 @@ func (jobStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { job.Spec.Suspend = nil } + if utilfeature.DefaultFeatureGate.Enabled(features.JobTrackingWithFinalizers) { + // Until this feature graduates to GA and soaks in clusters, we use an + // annotation to mark whether jobs are tracked with it. + addJobTrackingAnnotation(job) + } else { + dropJobTrackingAnnotation(job) + } + pod.DropDisabledTemplateFields(&job.Spec.Template, nil) } +func addJobTrackingAnnotation(job *batch.Job) { + if job.Annotations == nil { + job.Annotations = map[string]string{} + } + job.Annotations[batchv1.JobTrackingFinalizer] = "" +} + +func hasJobTrackingAnnotation(job *batch.Job) bool { + if job.Annotations == nil { + return false + } + _, ok := job.Annotations[batchv1.JobTrackingFinalizer] + return ok +} + +func dropJobTrackingAnnotation(job *batch.Job) { + delete(job.Annotations, batchv1.JobTrackingFinalizer) +} + // PrepareForUpdate clears fields that are not allowed to be set by end users on update. func (jobStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { newJob := obj.(*batch.Job) @@ -130,6 +158,9 @@ func (jobStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object newJob.Spec.Suspend = oldJob.Spec.Suspend } } + if !utilfeature.DefaultFeatureGate.Enabled(features.JobTrackingWithFinalizers) && !hasJobTrackingAnnotation(oldJob) { + dropJobTrackingAnnotation(newJob) + } pod.DropDisabledTemplateFields(&newJob.Spec.Template, &oldJob.Spec.Template) @@ -147,10 +178,31 @@ func (jobStrategy) Validate(ctx context.Context, obj runtime.Object) field.Error if job.Spec.ManualSelector == nil || *job.Spec.ManualSelector == false { generateSelector(job) } - opts := pod.GetValidationOptionsFromPodTemplate(&job.Spec.Template, nil) + opts := validationOptionsForJob(job, nil) return validation.ValidateJob(job, opts) } +func validationOptionsForJob(newJob, oldJob *batch.Job) validation.JobValidationOptions { + var newPodTemplate, oldPodTemplate *core.PodTemplateSpec + if newJob != nil { + newPodTemplate = &newJob.Spec.Template + } + if oldJob != nil { + oldPodTemplate = &oldJob.Spec.Template + } + opts := validation.JobValidationOptions{ + PodValidationOptions: pod.GetValidationOptionsFromPodTemplate(newPodTemplate, oldPodTemplate), + AllowTrackingAnnotation: utilfeature.DefaultFeatureGate.Enabled(features.JobTrackingWithFinalizers), + } + if oldJob != nil { + // Because we don't support the tracking with finalizers for already + // existing jobs, we allow the annotation only if the Job already had it, + // regardless of the feature gate. + opts.AllowTrackingAnnotation = hasJobTrackingAnnotation(oldJob) + } + return opts +} + // WarningsOnCreate returns warnings for the creation of the given object. func (jobStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { newJob := obj.(*batch.Job) @@ -225,9 +277,9 @@ func (jobStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) job := obj.(*batch.Job) oldJob := old.(*batch.Job) - opts := pod.GetValidationOptionsFromPodTemplate(&job.Spec.Template, &oldJob.Spec.Template) + opts := validationOptionsForJob(job, oldJob) validationErrorList := validation.ValidateJob(job, opts) - updateErrorList := validation.ValidateJobUpdate(job, oldJob, opts) + updateErrorList := validation.ValidateJobUpdate(job, oldJob, opts.PodValidationOptions) return append(validationErrorList, updateErrorList...) } diff --git a/pkg/registry/batch/job/strategy_test.go b/pkg/registry/batch/job/strategy_test.go index d0852b55a1a9..9fa55b912258 100644 --- a/pkg/registry/batch/job/strategy_test.go +++ b/pkg/registry/batch/job/strategy_test.go @@ -20,8 +20,12 @@ import ( "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + batchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" genericapirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/registry/rest" utilfeature "k8s.io/apiserver/pkg/util/feature" @@ -34,11 +38,14 @@ import ( "k8s.io/utils/pointer" ) +var ignoreErrValueDetail = cmpopts.IgnoreFields(field.Error{}, "BadValue", "Detail") + func TestJobStrategy(t *testing.T) { cases := map[string]struct { - ttlEnabled bool - indexedJobEnabled bool - suspendJobEnabled bool + ttlEnabled bool + indexedJobEnabled bool + suspendJobEnabled bool + trackingWithFinalizersEnabled bool }{ "features disabled": {}, "ttl enabled": { @@ -50,12 +57,16 @@ func TestJobStrategy(t *testing.T) { "suspend job enabled": { suspendJobEnabled: true, }, + "new job tracking enabled": { + trackingWithFinalizersEnabled: true, + }, } for name, tc := range cases { t.Run(name, func(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.TTLAfterFinished, tc.ttlEnabled)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IndexedJob, tc.indexedJobEnabled)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SuspendJob, tc.suspendJobEnabled)() + defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.JobTrackingWithFinalizers, tc.trackingWithFinalizersEnabled)() testJobStrategy(t) }) } @@ -65,6 +76,7 @@ func testJobStrategy(t *testing.T) { ttlEnabled := utilfeature.DefaultFeatureGate.Enabled(features.TTLAfterFinished) indexedJobEnabled := utilfeature.DefaultFeatureGate.Enabled(features.IndexedJob) suspendJobEnabled := utilfeature.DefaultFeatureGate.Enabled(features.SuspendJob) + trackingWithFinalizersEnabled := utilfeature.DefaultFeatureGate.Enabled(features.JobTrackingWithFinalizers) ctx := genericapirequest.NewDefaultContext() if !Strategy.NamespaceScoped() { t.Errorf("Job must be namespace scoped") @@ -90,6 +102,10 @@ func testJobStrategy(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "myjob", Namespace: metav1.NamespaceDefault, + Annotations: map[string]string{ + "foo": "bar", + }, + ResourceVersion: "0", }, Spec: batch.JobSpec{ Selector: validSelector, @@ -126,6 +142,13 @@ func testJobStrategy(t *testing.T) { if !suspendJobEnabled && (job.Spec.Suspend != nil) { t.Errorf("Job should allow setting .spec.suspend only when %v feature is enabled", features.SuspendJob) } + wantAnnotations := map[string]string{"foo": "bar"} + if trackingWithFinalizersEnabled { + wantAnnotations[batchv1.JobTrackingFinalizer] = "" + } + if diff := cmp.Diff(wantAnnotations, job.Annotations); diff != "" { + t.Errorf("Job has annotations (-want,+got):\n%s", diff) + } parallelism := int32(10) @@ -136,9 +159,18 @@ func testJobStrategy(t *testing.T) { if updatedLabelJob.Generation != 1 { t.Errorf("expected Generation=1, got %d", updatedLabelJob.Generation) } + errs = Strategy.ValidateUpdate(ctx, updatedLabelJob, job) + if len(errs) != 0 { + t.Errorf("Unexpected update validation error") + } updatedJob := &batch.Job{ - ObjectMeta: metav1.ObjectMeta{Name: "bar", ResourceVersion: "4"}, + ObjectMeta: metav1.ObjectMeta{ + Name: "bar", + ResourceVersion: "4", + // remove one annotation and try to enforce the job tracking finalizer. + Annotations: map[string]string{batchv1.JobTrackingFinalizer: ""}, + }, Spec: batch.JobSpec{ Parallelism: ¶llelism, Completions: pointer.Int32Ptr(2), @@ -162,12 +194,30 @@ func testJobStrategy(t *testing.T) { if ttlEnabled != (updatedJob.Spec.TTLSecondsAfterFinished != nil) { t.Errorf("Job should only allow updating .spec.ttlSecondsAfterFinished when %v feature is enabled", features.TTLAfterFinished) } + wantAnnotations = make(map[string]string) + if trackingWithFinalizersEnabled { + wantAnnotations[batchv1.JobTrackingFinalizer] = "" + } + if diff := cmp.Diff(wantAnnotations, updatedJob.Annotations); diff != "" { + t.Errorf("Job has annotations (-want,+got):\n%s", diff) + } errs = Strategy.ValidateUpdate(ctx, updatedJob, job) if len(errs) == 0 { t.Errorf("Expected a validation error") } + // Ensure going from legacy tracking Job to tracking with finalizers is + // disallowed. + job = job.DeepCopy() + job.Annotations = nil + updatedJob = job.DeepCopy() + updatedJob.Annotations = map[string]string{batch.JobTrackingFinalizer: ""} + errs = Strategy.ValidateUpdate(ctx, updatedJob, job) + if len(errs) != 1 { + t.Errorf("Expected update validation error") + } + // Test updating suspend false->true and nil-> true when the feature gate is // disabled. We don't care about other combinations. job.Spec.Suspend, updatedJob.Spec.Suspend = pointer.BoolPtr(false), pointer.BoolPtr(true) @@ -200,6 +250,149 @@ func testJobStrategy(t *testing.T) { } } +func TestJobStrategyValidateUpdate(t *testing.T) { + ctx := genericapirequest.NewDefaultContext() + validSelector := &metav1.LabelSelector{ + MatchLabels: map[string]string{"a": "b"}, + } + validPodTemplateSpec := api.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: validSelector.MatchLabels, + }, + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyOnFailure, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: api.TerminationMessageReadFile}}, + }, + } + cases := map[string]struct { + job *batch.Job + update func(*batch.Job) + wantErrs field.ErrorList + trackingWithFinalizersEnabled bool + }{ + "update parallelism": { + job: &batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "0", + }, + Spec: batch.JobSpec{ + Selector: validSelector, + Template: validPodTemplateSpec, + ManualSelector: pointer.BoolPtr(true), + Parallelism: pointer.Int32Ptr(1), + }, + }, + update: func(job *batch.Job) { + job.Spec.Parallelism = pointer.Int32Ptr(2) + }, + }, + "update completions disallowed": { + job: &batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "0", + }, + Spec: batch.JobSpec{ + Selector: validSelector, + Template: validPodTemplateSpec, + ManualSelector: pointer.BoolPtr(true), + Parallelism: pointer.Int32Ptr(1), + Completions: pointer.Int32Ptr(1), + }, + }, + update: func(job *batch.Job) { + job.Spec.Completions = pointer.Int32Ptr(2) + }, + wantErrs: field.ErrorList{ + {Type: field.ErrorTypeInvalid, Field: "spec.completions"}, + }, + }, + "adding tracking annotation disallowed, gate disabled": { + job: &batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "0", + Annotations: map[string]string{"foo": "bar"}, + }, + Spec: batch.JobSpec{ + Selector: validSelector, + Template: validPodTemplateSpec, + ManualSelector: pointer.BoolPtr(true), + Parallelism: pointer.Int32Ptr(1), + }, + }, + update: func(job *batch.Job) { + job.Annotations[batch.JobTrackingFinalizer] = "" + }, + wantErrs: field.ErrorList{ + {Type: field.ErrorTypeForbidden, Field: "metadata.annotations[batch.kubernetes.io/job-tracking]"}, + }, + }, + "adding tracking annotation disallowed, gate enabled": { + job: &batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "0", + Annotations: map[string]string{"foo": "bar"}, + }, + Spec: batch.JobSpec{ + Selector: validSelector, + Template: validPodTemplateSpec, + ManualSelector: pointer.BoolPtr(true), + Parallelism: pointer.Int32Ptr(1), + }, + }, + update: func(job *batch.Job) { + job.Annotations[batch.JobTrackingFinalizer] = "" + }, + wantErrs: field.ErrorList{ + {Type: field.ErrorTypeForbidden, Field: "metadata.annotations[batch.kubernetes.io/job-tracking]"}, + }, + trackingWithFinalizersEnabled: true, + }, + "preserving tracking annotation, feature disabled": { + job: &batch.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: "myjob", + Namespace: metav1.NamespaceDefault, + ResourceVersion: "0", + Annotations: map[string]string{ + batch.JobTrackingFinalizer: "", + }, + }, + Spec: batch.JobSpec{ + Selector: validSelector, + Template: validPodTemplateSpec, + ManualSelector: pointer.BoolPtr(true), + Parallelism: pointer.Int32Ptr(1), + }, + }, + update: func(job *batch.Job) { + // change something. + job.Annotations["foo"] = "bar" + }, + }, + } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.JobTrackingWithFinalizers, tc.trackingWithFinalizersEnabled)() + newJob := tc.job.DeepCopy() + tc.update(newJob) + errs := Strategy.ValidateUpdate(ctx, newJob, tc.job) + if diff := cmp.Diff(tc.wantErrs, errs, ignoreErrValueDetail); diff != "" { + t.Errorf("Unexpected errors (-want,+got):\n%s", diff) + } + }) + } + +} + func TestJobStrategyWithGeneration(t *testing.T) { ctx := genericapirequest.NewDefaultContext() diff --git a/staging/src/k8s.io/api/batch/v1/generated.pb.go b/staging/src/k8s.io/api/batch/v1/generated.pb.go index 1407caebc61f..b8a10283175f 100644 --- a/staging/src/k8s.io/api/batch/v1/generated.pb.go +++ b/staging/src/k8s.io/api/batch/v1/generated.pb.go @@ -33,6 +33,8 @@ import ( math_bits "math/bits" reflect "reflect" strings "strings" + + k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" ) // Reference imports to suppress errors if they are not otherwise used. @@ -326,6 +328,34 @@ func (m *JobTemplateSpec) XXX_DiscardUnknown() { var xxx_messageInfo_JobTemplateSpec proto.InternalMessageInfo +func (m *UncountedTerminatedPods) Reset() { *m = UncountedTerminatedPods{} } +func (*UncountedTerminatedPods) ProtoMessage() {} +func (*UncountedTerminatedPods) Descriptor() ([]byte, []int) { + return fileDescriptor_3b52da57c93de713, []int{10} +} +func (m *UncountedTerminatedPods) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UncountedTerminatedPods) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *UncountedTerminatedPods) XXX_Merge(src proto.Message) { + xxx_messageInfo_UncountedTerminatedPods.Merge(m, src) +} +func (m *UncountedTerminatedPods) XXX_Size() int { + return m.Size() +} +func (m *UncountedTerminatedPods) XXX_DiscardUnknown() { + xxx_messageInfo_UncountedTerminatedPods.DiscardUnknown(m) +} + +var xxx_messageInfo_UncountedTerminatedPods proto.InternalMessageInfo + func init() { proto.RegisterType((*CronJob)(nil), "k8s.io.api.batch.v1.CronJob") proto.RegisterType((*CronJobList)(nil), "k8s.io.api.batch.v1.CronJobList") @@ -337,6 +367,7 @@ func init() { proto.RegisterType((*JobSpec)(nil), "k8s.io.api.batch.v1.JobSpec") proto.RegisterType((*JobStatus)(nil), "k8s.io.api.batch.v1.JobStatus") proto.RegisterType((*JobTemplateSpec)(nil), "k8s.io.api.batch.v1.JobTemplateSpec") + proto.RegisterType((*UncountedTerminatedPods)(nil), "k8s.io.api.batch.v1.UncountedTerminatedPods") } func init() { @@ -344,89 +375,95 @@ func init() { } var fileDescriptor_3b52da57c93de713 = []byte{ - // 1304 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xc6, 0x71, 0x6c, 0x8f, 0x93, 0xd4, 0x9d, 0xd2, 0xd6, 0x98, 0xca, 0x1b, 0x4c, 0x41, - 0x01, 0xc1, 0x9a, 0x94, 0x08, 0x21, 0x04, 0x48, 0xd9, 0x54, 0x15, 0x0d, 0x8e, 0x1a, 0xc6, 0xa9, - 0x90, 0xa0, 0x20, 0xc6, 0xbb, 0x63, 0x67, 0x9b, 0xdd, 0x9d, 0xd5, 0xce, 0xd8, 0x22, 0x37, 0x7e, - 0x02, 0xbf, 0x02, 0x71, 0x42, 0x48, 0xdc, 0x39, 0xa2, 0x1e, 0x7b, 0xec, 0x69, 0x45, 0x97, 0x1b, - 0x17, 0xee, 0xe1, 0x82, 0x76, 0x76, 0xbc, 0xbb, 0xb6, 0x77, 0x43, 0xd3, 0x43, 0xc5, 0xcd, 0xfb, - 0xe6, 0xfb, 0xbe, 0x79, 0x7e, 0xef, 0xcd, 0x7b, 0x0f, 0x7c, 0x74, 0xf2, 0x01, 0xd3, 0x2c, 0xda, - 0x3d, 0x19, 0x0f, 0x88, 0xef, 0x12, 0x4e, 0x58, 0x77, 0x42, 0x5c, 0x93, 0xfa, 0x5d, 0x79, 0x80, - 0x3d, 0xab, 0x3b, 0xc0, 0xdc, 0x38, 0xee, 0x4e, 0xb6, 0xbb, 0x23, 0xe2, 0x12, 0x1f, 0x73, 0x62, - 0x6a, 0x9e, 0x4f, 0x39, 0x85, 0x57, 0x62, 0x90, 0x86, 0x3d, 0x4b, 0x13, 0x20, 0x6d, 0xb2, 0xdd, - 0x7a, 0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7, 0xed, 0xa5, 0xc7, 0x4f, 0xdb, 0x4b, 0x4f, 0x9e, 0xb6, 0x97, - 0xbe, 0x0f, 0xdb, 0xca, 0xa3, 0xb0, 0xad, 0x3c, 0x0e, 0xdb, 0xca, 0x93, 0xb0, 0xad, 0xfc, 0x11, - 0xb6, 0x95, 0x1f, 0xfe, 0x6c, 0x2f, 0x7d, 0xb9, 0x3c, 0xd9, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, - 0x5a, 0x54, 0xec, 0x5f, 0x44, 0x0f, 0x00, 0x00, + // 1395 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0xc6, 0x76, 0x6c, 0x8f, 0x93, 0xd4, 0x9d, 0x7e, 0xdb, 0xfa, 0x6b, 0x2a, 0x6f, 0x6a, + 0x0a, 0x0a, 0xa8, 0xac, 0x49, 0x88, 0x10, 0x42, 0x80, 0x94, 0x4d, 0x55, 0x68, 0x70, 0xd4, 0x30, + 0x76, 0x84, 0x04, 0x05, 0xb1, 0xde, 0x1d, 0x3b, 0xdb, 0xec, 0xee, 0x58, 0x3b, 0x63, 0x8b, 0xdc, + 0x90, 0xf8, 0x07, 0xf8, 0x2b, 0x10, 0x27, 0x84, 0x04, 0x67, 0x8e, 0xa8, 0xc7, 0x1e, 0x7b, 0x5a, + 0xd1, 0xe5, 0x0f, 0x80, 0x73, 0xb8, 0xa0, 0x9d, 0x1d, 0xef, 0x0f, 0x7b, 0x37, 0xa4, 0x3d, 0x54, + 0xdc, 0xbc, 0x6f, 0x3e, 0x9f, 0xcf, 0xbc, 0x99, 0xf7, 0xe6, 0xbd, 0x67, 0xf0, 0xde, 0xc9, 0x3b, + 0x54, 0x31, 0x49, 0xe7, 0x64, 0x32, 0xc0, 0xae, 0x83, 0x19, 0xa6, 0x9d, 0x29, 0x76, 0x0c, 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0x7f, 0xbe, 0x27, 0xd7, 0xbb, 0x73, 0x3a, 0x68, 0x41, 0x19, 0xba, 0x00, + 0x72, 0x5b, 0x74, 0x85, 0x7c, 0xbf, 0xd2, 0x33, 0xef, 0x77, 0xcd, 0xf7, 0x64, 0xd8, 0x5d, 0x50, + 0x42, 0x19, 0xea, 0xed, 0x3f, 0x25, 0x50, 0x78, 0x31, 0x65, 0xf1, 0x83, 0x54, 0x59, 0xbc, 0x91, + 0x97, 0xb4, 0xb9, 0x25, 0xf1, 0xee, 0x5c, 0x49, 0x6c, 0xe5, 0x2a, 0x9c, 0x5f, 0x0e, 0x7f, 0x2b, + 0x80, 0xd5, 0x7d, 0x32, 0xd8, 0x23, 0x8e, 0x61, 0x32, 0x93, 0x38, 0x70, 0x07, 0x14, 0xd9, 0xe9, + 0x78, 0x56, 0x5a, 0x36, 0x66, 0x5b, 0xf7, 0x4f, 0xc7, 0xf8, 0xcc, 0x93, 0xeb, 0x49, 0x6c, 0x60, + 0x43, 0x1c, 0x0d, 0xbb, 0x91, 0x3b, 0xcb, 0x9c, 0xb7, 0x93, 0xde, 0xee, 0xcc, 0x93, 0x33, 0x1a, + 0xa7, 0x12, 0x29, 0xa5, 0x9d, 0x82, 0x23, 0xb0, 0x16, 0x04, 0xe7, 0xd0, 0x25, 0x83, 0x30, 0xcb, + 0x0a, 0xcf, 0x1c, 0xf5, 0xab, 0xc2, 0x81, 0xb5, 0x6e, 0x52, 0x08, 0xa5, 0x75, 0xe1, 0x34, 0xcc, + 0xb1, 0xbe, 0xab, 0x39, 0x34, 0x3c, 0xd2, 0xf3, 0xe5, 0x74, 0x53, 0xec, 0xc6, 0xf3, 0x2c, 0xad, + 0x86, 0x32, 0x76, 0x80, 0xaf, 0x82, 0x15, 0x17, 0x6b, 0x94, 0x38, 0x3c, 0x9f, 0xab, 0x71, 0x74, + 0x10, 0xb7, 0x22, 0xb1, 0x0a, 0x5f, 0x03, 0x65, 0x1b, 0x53, 0xaa, 0x8d, 0x30, 0xaf, 0x38, 0x55, + 0xf5, 0x92, 0x00, 0x96, 0x0f, 0x42, 0x33, 0x9a, 0xad, 0xb7, 0xbf, 0x97, 0x40, 0xf9, 0xc5, 0xf4, + 0xb4, 0xf7, 0xd3, 0x3d, 0xad, 0x91, 0x97, 0x79, 0x39, 0xfd, 0xec, 0xa7, 0x12, 0x77, 0x94, 0xf7, + 0xb2, 0x2d, 0x50, 0x1b, 0x6b, 0xae, 0x66, 0x59, 0xd8, 0x32, 0xa9, 0xcd, 0x7d, 0x2d, 0xa9, 0x97, + 0x82, 0xba, 0x7c, 0x18, 0x9b, 0x51, 0x12, 0x13, 0x50, 0x74, 0x62, 0x8f, 0x2d, 0x1c, 0x5c, 0x66, + 0x98, 0x6e, 0x82, 0xb2, 0x17, 0x9b, 0x51, 0x12, 0x03, 0xef, 0x83, 0xab, 0x61, 0x05, 0x9b, 0xef, + 0x80, 0x05, 0xde, 0x01, 0xff, 0xef, 0x7b, 0xf2, 0xd5, 0xdd, 0x2c, 0x00, 0xca, 0xe6, 0xc1, 0x1d, + 0xb0, 0x3a, 0xd0, 0xf4, 0x13, 0x32, 0x1c, 0x26, 0x2b, 0x76, 0xdd, 0xf7, 0xe4, 0x55, 0x35, 0x61, + 0x47, 0x29, 0x14, 0xfc, 0x02, 0x54, 0x28, 0xb6, 0xb0, 0xce, 0x88, 0x2b, 0x52, 0xec, 0xad, 0x0b, + 0x46, 0x45, 0x1b, 0x60, 0xab, 0x27, 0xa8, 0xea, 0x2a, 0xef, 0xf4, 0xe2, 0x0b, 0x45, 0x92, 0xf0, + 0x5d, 0xb0, 0x6e, 0x6b, 0xce, 0x44, 0x8b, 0x90, 0x3c, 0xb7, 0x2a, 0x2a, 0xf4, 0x3d, 0x79, 0xfd, + 0x20, 0xb5, 0x82, 0xe6, 0x90, 0xf0, 0x13, 0x50, 0x61, 0xb3, 0x36, 0xba, 0xc2, 0x5d, 0xcb, 0x6c, + 0x14, 0x87, 0xc4, 0x48, 0x75, 0xd1,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f, 0x31, 0xe5, + 0x4f, 0xb3, 0xaa, 0x36, 0x04, 0xa3, 0xbe, 0x37, 0xb7, 0x8e, 0x16, 0x18, 0xf0, 0x5b, 0x09, 0x5c, + 0x9f, 0x38, 0x3a, 0x99, 0x38, 0x0c, 0x1b, 0x7d, 0xec, 0xda, 0xa6, 0x13, 0xfc, 0x79, 0x3a, 0x24, + 0x06, 0xe5, 0x99, 0x5b, 0xdb, 0xbe, 0x9d, 0x19, 0xec, 0xa3, 0x6c, 0x4e, 0x98, 0xe7, 0x39, 0x8b, + 0x28, 0x6f, 0xa7, 0xf6, 0xcf, 0x12, 0xb8, 0x34, 0x37, 0xb4, 0xfe, 0xf7, 0xa7, 0x92, 0xf6, 0x2f, + 0x12, 0xc8, 0x3b, 0x2a, 0x3c, 0x4c, 0x86, 0x3d, 0x78, 0x35, 0x55, 0x75, 0x3b, 0x15, 0xf2, 0x33, + 0x4f, 0xbe, 0x99, 0xf7, 0x97, 0x36, 0x18, 0x32, 0xa8, 0x72, 0x74, 0xef, 0x4e, 0x32, 0x2f, 0x3e, + 0x8c, 0xf2, 0x62, 0x99, 0xcb, 0x75, 0xe2, 0x9c, 0xb8, 0x98, 0x96, 0xa0, 0xab, 0x9b, 0x8f, 0x9e, + 0xb6, 0x96, 0x1e, 0x3f, 0x6d, 0x2d, 0x3d, 0x79, 0xda, 0x5a, 0xfa, 0xc6, 0x6f, 0x49, 0x8f, 0xfc, + 0x96, 0xf4, 0xd8, 0x6f, 0x49, 0x4f, 0xfc, 0x96, 0xf4, 0xbb, 0xdf, 0x92, 0xbe, 0xfb, 0xa3, 0xb5, + 0xf4, 0xd9, 0xf2, 0x74, 0xeb, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xfc, 0x0b, 0x48, 0x81, + 0x10, 0x00, 0x00, } func (m *CronJob) Marshal() (dAtA []byte, err error) { @@ -938,6 +975,18 @@ func (m *JobStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.UncountedTerminatedPods != nil { + { + size, err := m.UncountedTerminatedPods.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } i -= len(m.CompletedIndexes) copy(dAtA[i:], m.CompletedIndexes) i = encodeVarintGenerated(dAtA, i, uint64(len(m.CompletedIndexes))) @@ -1036,6 +1085,47 @@ func (m *JobTemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *UncountedTerminatedPods) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UncountedTerminatedPods) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UncountedTerminatedPods) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Failed) > 0 { + for iNdEx := len(m.Failed) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Failed[iNdEx]) + copy(dAtA[i:], m.Failed[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Failed[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Succeeded) > 0 { + for iNdEx := len(m.Succeeded) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Succeeded[iNdEx]) + copy(dAtA[i:], m.Succeeded[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Succeeded[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset @@ -1247,6 +1337,10 @@ func (m *JobStatus) Size() (n int) { n += 1 + sovGenerated(uint64(m.Failed)) l = len(m.CompletedIndexes) n += 1 + l + sovGenerated(uint64(l)) + if m.UncountedTerminatedPods != nil { + l = m.UncountedTerminatedPods.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1263,6 +1357,27 @@ func (m *JobTemplateSpec) Size() (n int) { return n } +func (m *UncountedTerminatedPods) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Succeeded) > 0 { + for _, s := range m.Succeeded { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Failed) > 0 { + for _, s := range m.Failed { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1409,6 +1524,7 @@ func (this *JobStatus) String() string { `Succeeded:` + fmt.Sprintf("%v", this.Succeeded) + `,`, `Failed:` + fmt.Sprintf("%v", this.Failed) + `,`, `CompletedIndexes:` + fmt.Sprintf("%v", this.CompletedIndexes) + `,`, + `UncountedTerminatedPods:` + strings.Replace(this.UncountedTerminatedPods.String(), "UncountedTerminatedPods", "UncountedTerminatedPods", 1) + `,`, `}`, }, "") return s @@ -1424,6 +1540,17 @@ func (this *JobTemplateSpec) String() string { }, "") return s } +func (this *UncountedTerminatedPods) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UncountedTerminatedPods{`, + `Succeeded:` + fmt.Sprintf("%v", this.Succeeded) + `,`, + `Failed:` + fmt.Sprintf("%v", this.Failed) + `,`, + `}`, + }, "") + return s +} func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -3110,6 +3237,42 @@ func (m *JobStatus) Unmarshal(dAtA []byte) error { } m.CompletedIndexes = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UncountedTerminatedPods", 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.UncountedTerminatedPods == nil { + m.UncountedTerminatedPods = &UncountedTerminatedPods{} + } + if err := m.UncountedTerminatedPods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3247,6 +3410,120 @@ func (m *JobTemplateSpec) Unmarshal(dAtA []byte) error { } return nil } +func (m *UncountedTerminatedPods) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UncountedTerminatedPods: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UncountedTerminatedPods: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Succeeded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Succeeded = append(m.Succeeded, k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Failed", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Failed = append(m.Failed, k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/staging/src/k8s.io/api/batch/v1/generated.proto b/staging/src/k8s.io/api/batch/v1/generated.proto index 12092565ccb3..1aefe05269d6 100644 --- a/staging/src/k8s.io/api/batch/v1/generated.proto +++ b/staging/src/k8s.io/api/batch/v1/generated.proto @@ -321,6 +321,24 @@ message JobStatus { // represented as "1,3-5,7". // +optional optional string completedIndexes = 7; + + // UncountedTerminatedPods holds the UIDs of Pods that have terminated but + // the job controller hasn't yet accounted for in the status counters. + // + // The job controller creates pods with a finalizer. When a pod terminates + // (succeeded or failed), the controller does three steps to account for it + // in the job status: + // (1) Add the pod UID to the arrays in this field. + // (2) Remove the pod finalizer. + // (3) Remove the pod UID from the arrays while increasing the corresponding + // counter. + // + // This field is alpha-level. The job controller only makes use of this field + // when the feature gate PodTrackingWithFinalizers is enabled. + // Old jobs might not be tracked using this field, in which case the field + // remains null. + // +optional + optional UncountedTerminatedPods uncountedTerminatedPods = 8; } // JobTemplateSpec describes the data a Job should have when created from a template @@ -336,3 +354,17 @@ message JobTemplateSpec { optional JobSpec spec = 2; } +// UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't +// been accounted in Job status counters. +message UncountedTerminatedPods { + // Succeeded holds UIDs of succeeded Pods. + // +listType=set + // +optional + repeated string succeeded = 1; + + // Failed holds UIDs of failed Pods. + // +listType=set + // +optional + repeated string failed = 2; +} + diff --git a/staging/src/k8s.io/api/batch/v1/types.go b/staging/src/k8s.io/api/batch/v1/types.go index 1803fabfd849..77742e5f8cec 100644 --- a/staging/src/k8s.io/api/batch/v1/types.go +++ b/staging/src/k8s.io/api/batch/v1/types.go @@ -19,9 +19,20 @@ package v1 import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) -const JobCompletionIndexAnnotation = "batch.kubernetes.io/job-completion-index" +const ( + JobCompletionIndexAnnotation = "batch.kubernetes.io/job-completion-index" + + // JobTrackingFinalizer is a finalizer for Job's pods. It prevents them from + // being deleted before being accounted in the Job status. + // The apiserver and job controller use this string as a Job annotation, to + // mark Jobs that are being tracked using pod finalizers. Two releases after + // the JobTrackingWithFinalizers graduates to GA, JobTrackingFinalizer will + // no longer be used as a Job annotation. + JobTrackingFinalizer = "batch.kubernetes.io/job-tracking" +) // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -237,6 +248,38 @@ type JobStatus struct { // represented as "1,3-5,7". // +optional CompletedIndexes string `json:"completedIndexes,omitempty" protobuf:"bytes,7,opt,name=completedIndexes"` + + // UncountedTerminatedPods holds the UIDs of Pods that have terminated but + // the job controller hasn't yet accounted for in the status counters. + // + // The job controller creates pods with a finalizer. When a pod terminates + // (succeeded or failed), the controller does three steps to account for it + // in the job status: + // (1) Add the pod UID to the arrays in this field. + // (2) Remove the pod finalizer. + // (3) Remove the pod UID from the arrays while increasing the corresponding + // counter. + // + // This field is alpha-level. The job controller only makes use of this field + // when the feature gate PodTrackingWithFinalizers is enabled. + // Old jobs might not be tracked using this field, in which case the field + // remains null. + // +optional + UncountedTerminatedPods *UncountedTerminatedPods `json:"uncountedTerminatedPods,omitempty" protobuf:"bytes,8,opt,name=uncountedTerminatedPods"` +} + +// UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't +// been accounted in Job status counters. +type UncountedTerminatedPods struct { + // Succeeded holds UIDs of succeeded Pods. + // +listType=set + // +optional + Succeeded []types.UID `json:"succeeded,omitempty" protobuf:"bytes,1,rep,name=succeeded,casttype=k8s.io/apimachinery/pkg/types.UID"` + + // Failed holds UIDs of failed Pods. + // +listType=set + // +optional + Failed []types.UID `json:"failed,omitempty" protobuf:"bytes,2,rep,name=failed,casttype=k8s.io/apimachinery/pkg/types.UID"` } type JobConditionType string diff --git a/staging/src/k8s.io/api/batch/v1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/batch/v1/types_swagger_doc_generated.go index da3ef6a24a23..f6e01000da9a 100644 --- a/staging/src/k8s.io/api/batch/v1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/batch/v1/types_swagger_doc_generated.go @@ -128,14 +128,15 @@ func (JobSpec) SwaggerDoc() map[string]string { } var map_JobStatus = map[string]string{ - "": "JobStatus represents the current state of a Job.", - "conditions": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", - "startTime": "Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC.", - "completionTime": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is only set when the job finishes successfully.", - "active": "The number of actively running pods.", - "succeeded": "The number of pods which reached phase Succeeded.", - "failed": "The number of pods which reached phase Failed.", - "completedIndexes": "CompletedIndexes holds the completed indexes when .spec.completionMode = \"Indexed\" in a text format. The indexes are represented as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\".", + "": "JobStatus represents the current state of a Job.", + "conditions": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", + "startTime": "Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC.", + "completionTime": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is only set when the job finishes successfully.", + "active": "The number of actively running pods.", + "succeeded": "The number of pods which reached phase Succeeded.", + "failed": "The number of pods which reached phase Failed.", + "completedIndexes": "CompletedIndexes holds the completed indexes when .spec.completionMode = \"Indexed\" in a text format. The indexes are represented as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\".", + "uncountedTerminatedPods": "UncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status: (1) Add the pod UID to the arrays in this field. (2) Remove the pod finalizer. (3) Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nThis field is alpha-level. The job controller only makes use of this field when the feature gate PodTrackingWithFinalizers is enabled. Old jobs might not be tracked using this field, in which case the field remains null.", } func (JobStatus) SwaggerDoc() map[string]string { @@ -152,4 +153,14 @@ func (JobTemplateSpec) SwaggerDoc() map[string]string { return map_JobTemplateSpec } +var map_UncountedTerminatedPods = map[string]string{ + "": "UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't been accounted in Job status counters.", + "succeeded": "Succeeded holds UIDs of succeeded Pods.", + "failed": "Failed holds UIDs of failed Pods.", +} + +func (UncountedTerminatedPods) SwaggerDoc() map[string]string { + return map_UncountedTerminatedPods +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/staging/src/k8s.io/api/batch/v1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/batch/v1/zz_generated.deepcopy.go index 6018ad1d3c01..fe60aaf37908 100644 --- a/staging/src/k8s.io/api/batch/v1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/api/batch/v1/zz_generated.deepcopy.go @@ -24,6 +24,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -312,6 +313,11 @@ func (in *JobStatus) DeepCopyInto(out *JobStatus) { in, out := &in.CompletionTime, &out.CompletionTime *out = (*in).DeepCopy() } + if in.UncountedTerminatedPods != nil { + in, out := &in.UncountedTerminatedPods, &out.UncountedTerminatedPods + *out = new(UncountedTerminatedPods) + (*in).DeepCopyInto(*out) + } return } @@ -342,3 +348,29 @@ func (in *JobTemplateSpec) DeepCopy() *JobTemplateSpec { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UncountedTerminatedPods) DeepCopyInto(out *UncountedTerminatedPods) { + *out = *in + if in.Succeeded != nil { + in, out := &in.Succeeded, &out.Succeeded + *out = make([]types.UID, len(*in)) + copy(*out, *in) + } + if in.Failed != nil { + in, out := &in.Failed, &out.Failed + *out = make([]types.UID, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UncountedTerminatedPods. +func (in *UncountedTerminatedPods) DeepCopy() *UncountedTerminatedPods { + if in == nil { + return nil + } + out := new(UncountedTerminatedPods) + in.DeepCopyInto(out) + return out +} diff --git a/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.json b/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.json index e76149b1ef12..530bf57dc869 100644 --- a/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.json +++ b/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.json @@ -1565,6 +1565,14 @@ "active": 543081713, "succeeded": -377965530, "failed": 77405208, - "completedIndexes": "495" + "completedIndexes": "495", + "uncountedTerminatedPods": { + "succeeded": [ + "Ʊ巭銔07?为Èá網抒h" + ], + "failed": [ + "W" + ] + } } } \ No newline at end of file diff --git a/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.pb b/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.pb index 8bdcc0505571..0738639c5965 100644 Binary files a/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.pb and b/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.pb differ diff --git a/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.yaml b/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.yaml index 2c2f1a5e14d1..7689fb98830b 100644 --- a/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.yaml +++ b/staging/src/k8s.io/api/testdata/HEAD/batch.v1.Job.yaml @@ -1072,3 +1072,8 @@ status: type: ɓ为\Ŧƺ猑\#ȼ縤ɰTaI楅© failed: 77405208 succeeded: -377965530 + uncountedTerminatedPods: + failed: + - W + succeeded: + - Ʊ巭銔07?为Èá網抒h diff --git a/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go b/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go index 4d9efe3f72bd..66e8d677a4e3 100644 --- a/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go +++ b/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go @@ -143,7 +143,7 @@ func ValidateImmutableField(newVal, oldVal interface{}, fldPath *field.Path) fie func ValidateObjectMeta(objMeta *metav1.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList { metadata, err := meta.Accessor(objMeta) if err != nil { - allErrs := field.ErrorList{} + var allErrs field.ErrorList allErrs = append(allErrs, field.Invalid(fldPath, objMeta, err.Error())) return allErrs } @@ -154,7 +154,7 @@ func ValidateObjectMeta(objMeta *metav1.ObjectMeta, requiresNamespace bool, name // been performed. // It doesn't return an error for rootscoped resources with namespace, because namespace should already be cleared before. func ValidateObjectMetaAccessor(meta metav1.Object, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} + var allErrs field.ErrorList if len(meta.GetGenerateName()) != 0 { for _, msg := range nameFn(meta.GetGenerateName(), true) { diff --git a/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go b/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go index e59d49cf1aa6..ba7e27e0850e 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go @@ -25,13 +25,14 @@ import ( // JobStatusApplyConfiguration represents an declarative configuration of the JobStatus type for use // with apply. type JobStatusApplyConfiguration struct { - Conditions []JobConditionApplyConfiguration `json:"conditions,omitempty"` - StartTime *metav1.Time `json:"startTime,omitempty"` - CompletionTime *metav1.Time `json:"completionTime,omitempty"` - Active *int32 `json:"active,omitempty"` - Succeeded *int32 `json:"succeeded,omitempty"` - Failed *int32 `json:"failed,omitempty"` - CompletedIndexes *string `json:"completedIndexes,omitempty"` + Conditions []JobConditionApplyConfiguration `json:"conditions,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + Active *int32 `json:"active,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` + CompletedIndexes *string `json:"completedIndexes,omitempty"` + UncountedTerminatedPods *UncountedTerminatedPodsApplyConfiguration `json:"uncountedTerminatedPods,omitempty"` } // JobStatusApplyConfiguration constructs an declarative configuration of the JobStatus type for use with @@ -100,3 +101,11 @@ func (b *JobStatusApplyConfiguration) WithCompletedIndexes(value string) *JobSta b.CompletedIndexes = &value return b } + +// WithUncountedTerminatedPods sets the UncountedTerminatedPods 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 UncountedTerminatedPods field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithUncountedTerminatedPods(value *UncountedTerminatedPodsApplyConfiguration) *JobStatusApplyConfiguration { + b.UncountedTerminatedPods = value + return b +} diff --git a/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/uncountedterminatedpods.go b/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/uncountedterminatedpods.go new file mode 100644 index 000000000000..1409303fff3a --- /dev/null +++ b/staging/src/k8s.io/client-go/applyconfigurations/batch/v1/uncountedterminatedpods.go @@ -0,0 +1,56 @@ +/* +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 ( + types "k8s.io/apimachinery/pkg/types" +) + +// UncountedTerminatedPodsApplyConfiguration represents an declarative configuration of the UncountedTerminatedPods type for use +// with apply. +type UncountedTerminatedPodsApplyConfiguration struct { + Succeeded []types.UID `json:"succeeded,omitempty"` + Failed []types.UID `json:"failed,omitempty"` +} + +// UncountedTerminatedPodsApplyConfiguration constructs an declarative configuration of the UncountedTerminatedPods type for use with +// apply. +func UncountedTerminatedPods() *UncountedTerminatedPodsApplyConfiguration { + return &UncountedTerminatedPodsApplyConfiguration{} +} + +// WithSucceeded adds the given value to the Succeeded 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 Succeeded field. +func (b *UncountedTerminatedPodsApplyConfiguration) WithSucceeded(values ...types.UID) *UncountedTerminatedPodsApplyConfiguration { + for i := range values { + b.Succeeded = append(b.Succeeded, values[i]) + } + return b +} + +// WithFailed adds the given value to the Failed 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 Failed field. +func (b *UncountedTerminatedPodsApplyConfiguration) WithFailed(values ...types.UID) *UncountedTerminatedPodsApplyConfiguration { + for i := range values { + b.Failed = append(b.Failed, values[i]) + } + return b +} diff --git a/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go b/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go index d665b3deb32e..0422cb214b37 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go @@ -2710,6 +2710,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: succeeded type: scalar: numeric + - name: uncountedTerminatedPods + type: + namedType: io.k8s.api.batch.v1.UncountedTerminatedPods - name: io.k8s.api.batch.v1.JobTemplateSpec map: fields: @@ -2721,6 +2724,21 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.api.batch.v1.JobSpec default: {} +- name: io.k8s.api.batch.v1.UncountedTerminatedPods + map: + fields: + - name: failed + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: succeeded + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: io.k8s.api.batch.v1beta1.CronJob map: fields: diff --git a/staging/src/k8s.io/client-go/applyconfigurations/utils.go b/staging/src/k8s.io/client-go/applyconfigurations/utils.go index cb5d14d881b1..ae3c9ecd9eba 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/utils.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/utils.go @@ -395,6 +395,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsbatchv1.JobStatusApplyConfiguration{} case batchv1.SchemeGroupVersion.WithKind("JobTemplateSpec"): return &applyconfigurationsbatchv1.JobTemplateSpecApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("UncountedTerminatedPods"): + return &applyconfigurationsbatchv1.UncountedTerminatedPodsApplyConfiguration{} // Group=batch, Version=v1beta1 case batchv1beta1.SchemeGroupVersion.WithKind("CronJob"):