From 0fdd4104626c9c7d9faed062dfb1793d3cb86d47 Mon Sep 17 00:00:00 2001 From: javaducky Date: Mon, 14 Nov 2022 20:43:56 -0600 Subject: [PATCH] Do not add annotations to initializer based upon runner specification Signed-off-by: javaducky --- pkg/resources/jobs/initializer.go | 15 ++++----------- pkg/resources/jobs/initializer_test.go | 6 ------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/pkg/resources/jobs/initializer.go b/pkg/resources/jobs/initializer.go index 865c54ab..370d508f 100644 --- a/pkg/resources/jobs/initializer.go +++ b/pkg/resources/jobs/initializer.go @@ -20,7 +20,6 @@ func NewInitializerJob(k6 *v1alpha1.K6, argLine string) (*batchv1.Job, error) { var ( image = "ghcr.io/grafana/operator:latest-runner" - annotations = make(map[string]string) labels = newLabels(k6.Name) serviceAccountName = "default" automountServiceAccountToken = true @@ -31,10 +30,6 @@ func NewInitializerJob(k6 *v1alpha1.K6, argLine string) (*batchv1.Job, error) { image = k6.Spec.Runner.Image } - if k6.Spec.Runner.Metadata.Annotations != nil { - annotations = k6.Spec.Runner.Metadata.Annotations - } - if k6.Spec.Runner.Metadata.Labels != nil { for k, v := range k6.Spec.Runner.Metadata.Labels { // Order not specified if _, ok := labels[k]; !ok { @@ -66,16 +61,14 @@ func NewInitializerJob(k6 *v1alpha1.K6, argLine string) (*batchv1.Job, error) { return &batchv1.Job{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-initializer", k6.Name), - Namespace: k6.Namespace, - Labels: labels, - Annotations: annotations, + Name: fmt.Sprintf("%s-initializer", k6.Name), + Namespace: k6.Namespace, + Labels: labels, }, Spec: batchv1.JobSpec{ Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: labels, - Annotations: annotations, + Labels: labels, }, Spec: corev1.PodSpec{ AutomountServiceAccountToken: &automountServiceAccountToken, diff --git a/pkg/resources/jobs/initializer_test.go b/pkg/resources/jobs/initializer_test.go index 36bfa35a..970c25fb 100644 --- a/pkg/resources/jobs/initializer_test.go +++ b/pkg/resources/jobs/initializer_test.go @@ -29,9 +29,6 @@ func TestNewInitializerJob(t *testing.T) { "k6_cr": "test", "label1": "awesome", }, - Annotations: map[string]string{ - "awesomeAnnotation": "dope", - }, }, Spec: batchv1.JobSpec{ Template: corev1.PodTemplateSpec{ @@ -41,9 +38,6 @@ func TestNewInitializerJob(t *testing.T) { "k6_cr": "test", "label1": "awesome", }, - Annotations: map[string]string{ - "awesomeAnnotation": "dope", - }, }, Spec: corev1.PodSpec{ AutomountServiceAccountToken: &automountServiceAccountToken,