remove tracking annotation from validation and webhooks

This commit is contained in:
kannon92
2022-12-21 19:26:43 +00:00
parent afeb78fd8f
commit 6a4cf352b8
4 changed files with 8 additions and 104 deletions

View File

@@ -223,17 +223,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,
@@ -243,17 +239,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,
@@ -263,17 +255,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{
@@ -979,23 +967,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{