From 8cecccbc886369146b1e863025e036cb2970de67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ga=C3=9F?= Date: Fri, 14 Dec 2018 14:52:25 +0100 Subject: [PATCH] Add spec/jobTemplate/metadata/labels to common labels transformer --- .../config/defaultconfig/commonlabels.go | 5 +++++ pkg/transformers/labelsandannotations_test.go | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/pkg/transformers/config/defaultconfig/commonlabels.go b/pkg/transformers/config/defaultconfig/commonlabels.go index 7efd6a54d..66943c1ed 100644 --- a/pkg/transformers/config/defaultconfig/commonlabels.go +++ b/pkg/transformers/config/defaultconfig/commonlabels.go @@ -130,6 +130,11 @@ commonLabels: group: batch kind: CronJob +- path: spec/jobTemplate/metadata/labels + create: true + group: batch + kind: CronJob + - path: spec/jobTemplate/spec/template/metadata/labels create: true group: batch diff --git a/pkg/transformers/labelsandannotations_test.go b/pkg/transformers/labelsandannotations_test.go index 979e25280..5bbaa70b6 100644 --- a/pkg/transformers/labelsandannotations_test.go +++ b/pkg/transformers/labelsandannotations_test.go @@ -355,6 +355,12 @@ func TestLabelsRun(t *testing.T) { "spec": map[string]interface{}{ "schedule": "* 23 * * *", "jobTemplate": map[string]interface{}{ + "metadata": map[string]interface{}{ + "labels": map[string]interface{}{ + "label-key1": "label-value1", + "label-key2": "label-value2", + }, + }, "spec": map[string]interface{}{ "template": map[string]interface{}{ "metadata": map[string]interface{}{ @@ -390,6 +396,12 @@ func TestLabelsRun(t *testing.T) { "spec": map[string]interface{}{ "schedule": "* 23 * * *", "jobTemplate": map[string]interface{}{ + "metadata": map[string]interface{}{ + "labels": map[string]interface{}{ + "label-key1": "label-value1", + "label-key2": "label-value2", + }, + }, "spec": map[string]interface{}{ "selector": map[string]interface{}{ "matchLabels": map[string]interface{}{