Skip to content

Commit

Permalink
Merge pull request #166 from grafana/paul/no-annos-for-initializer
Browse files Browse the repository at this point in the history
Do not add annotations to initializer based upon runner specification
  • Loading branch information
javaducky authored Nov 16, 2022
2 parents 4aceaa3 + 0fdd410 commit cb5e266
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
15 changes: 4 additions & 11 deletions pkg/resources/jobs/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions pkg/resources/jobs/initializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
Expand Down

0 comments on commit cb5e266

Please sign in to comment.