Merge pull request #117633 from kannon92/remove-job-tracking-finalizers

remove tracking annotation from validation and webhooks
This commit is contained in:
Kubernetes Prow Robot
2023-05-04 10:34:43 -07:00
committed by GitHub
4 changed files with 8 additions and 104 deletions

View File

@@ -213,17 +213,13 @@ func TestValidateJob(t *testing.T) {
},
"valid job tracking annotation": {
opts: JobValidationOptions{
AllowTrackingAnnotation: true,
RequirePrefixedLabels: true,
RequirePrefixedLabels: 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,
@@ -233,17 +229,13 @@ func TestValidateJob(t *testing.T) {
},
"valid batch labels": {
opts: JobValidationOptions{
AllowTrackingAnnotation: true,
RequirePrefixedLabels: true,
RequirePrefixedLabels: 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,
@@ -253,17 +245,13 @@ func TestValidateJob(t *testing.T) {
},
"do not allow new batch labels": {
opts: JobValidationOptions{
AllowTrackingAnnotation: true,
RequirePrefixedLabels: false,
RequirePrefixedLabels: false,
},
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: &metav1.LabelSelector{
@@ -922,23 +910,6 @@ func TestValidateJob(t *testing.T) {
},
opts: JobValidationOptions{RequirePrefixedLabels: true},
},
"metadata.annotations[batch.kubernetes.io/job-tracking]: cannot add this annotation": {
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,
},
},
opts: JobValidationOptions{RequirePrefixedLabels: true},
},
"spec.template.metadata.labels[controller-uid]: Required value: must be '1a2b3c'": {
job: batch.Job{
ObjectMeta: metav1.ObjectMeta{