From 9c6790e130f1a5edd39023e031e665a56301e11f Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Wed, 30 Oct 2024 12:48:22 +0300 Subject: [PATCH] feat: [TKC-2726] cronjob config (#5973) * feat: add cronjob config Signed-off-by: Vladislav Sukhin * feat: cronjob config model Signed-off-by: Vladislav Sukhin --------- Signed-off-by: Vladislav Sukhin --- api/v1/testkube.yaml | 2 ++ go.mod | 2 +- go.sum | 4 ++-- pkg/api/v1/testkube/model_test_workflow_cron_job_config.go | 1 + pkg/mapper/testworkflows/kube_openapi.go | 1 + pkg/mapper/testworkflows/openapi_kube.go | 1 + 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/v1/testkube.yaml b/api/v1/testkube.yaml index 4fb927f38b5..f73c0f80096 100644 --- a/api/v1/testkube.yaml +++ b/api/v1/testkube.yaml @@ -9580,6 +9580,8 @@ components: description: annotations to attach to the cron job additionalProperties: type: string + config: + $ref: "#/components/schemas/TestWorkflowConfigValue" TestWorkflowExecutionCR: type: object diff --git a/go.mod b/go.mod index 38c1daec072..3e0f58b24ea 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/kelseyhightower/envconfig v1.4.0 github.com/kubepug/kubepug v1.7.1 - github.com/kubeshop/testkube-operator v1.17.55-0.20241029195548-ba9b7a63a87d + github.com/kubeshop/testkube-operator v1.17.55-0.20241030092155-2a57f6e797e9 github.com/minio/minio-go/v7 v7.0.47 github.com/montanaflynn/stats v0.6.6 github.com/moogar0880/problems v0.1.1 diff --git a/go.sum b/go.sum index dd3696dac3d..c2c4e833550 100644 --- a/go.sum +++ b/go.sum @@ -402,8 +402,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubepug/kubepug v1.7.1 h1:LKhfSxS8Y5mXs50v+3Lpyec+cogErDLcV7CMUuiaisw= github.com/kubepug/kubepug v1.7.1/go.mod h1:lv+HxD0oTFL7ZWjj0u6HKhMbbTIId3eG7aWIW0gyF8g= -github.com/kubeshop/testkube-operator v1.17.55-0.20241029195548-ba9b7a63a87d h1:MuMJ26tJdEI8gYla2m9WuwDvaOh9DQbpOa8levKqy+A= -github.com/kubeshop/testkube-operator v1.17.55-0.20241029195548-ba9b7a63a87d/go.mod h1:P47tw1nKQFufdsZndyq2HG2MSa0zK/lU0XpRfZtEmIk= +github.com/kubeshop/testkube-operator v1.17.55-0.20241030092155-2a57f6e797e9 h1:0v4W4kPfuDBJxvfkgKhDFA71AgmV0B5Jdb8dR7n4bV4= +github.com/kubeshop/testkube-operator v1.17.55-0.20241030092155-2a57f6e797e9/go.mod h1:P47tw1nKQFufdsZndyq2HG2MSa0zK/lU0XpRfZtEmIk= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= diff --git a/pkg/api/v1/testkube/model_test_workflow_cron_job_config.go b/pkg/api/v1/testkube/model_test_workflow_cron_job_config.go index 5e12718b3e6..ad9974f4e2e 100644 --- a/pkg/api/v1/testkube/model_test_workflow_cron_job_config.go +++ b/pkg/api/v1/testkube/model_test_workflow_cron_job_config.go @@ -17,4 +17,5 @@ type TestWorkflowCronJobConfig struct { Labels map[string]string `json:"labels,omitempty"` // annotations to attach to the cron job Annotations map[string]string `json:"annotations,omitempty"` + Config map[string]string `json:"config,omitempty"` } diff --git a/pkg/mapper/testworkflows/kube_openapi.go b/pkg/mapper/testworkflows/kube_openapi.go index 9f452f681b8..a6b09db6864 100644 --- a/pkg/mapper/testworkflows/kube_openapi.go +++ b/pkg/mapper/testworkflows/kube_openapi.go @@ -462,6 +462,7 @@ func MapEventKubeToAPI(v testworkflowsv1.Event) testkube.TestWorkflowEvent { func MapCronJobConfigKubeToAPI(v testworkflowsv1.CronJobConfig) testkube.TestWorkflowCronJobConfig { return testkube.TestWorkflowCronJobConfig{ Cron: v.Cron, + Config: MapConfigValueKubeToAPI(v.Config), Labels: v.Labels, Annotations: v.Annotations, } diff --git a/pkg/mapper/testworkflows/openapi_kube.go b/pkg/mapper/testworkflows/openapi_kube.go index 012e1b3320a..2e668b1b9bb 100644 --- a/pkg/mapper/testworkflows/openapi_kube.go +++ b/pkg/mapper/testworkflows/openapi_kube.go @@ -367,6 +367,7 @@ func MapEventAPIToKube(v testkube.TestWorkflowEvent) testworkflowsv1.Event { func MapCronJobConfigAPIToKube(v testkube.TestWorkflowCronJobConfig) testworkflowsv1.CronJobConfig { return testworkflowsv1.CronJobConfig{ Cron: v.Cron, + Config: MapConfigValueAPIToKube(v.Config), Labels: v.Labels, Annotations: v.Annotations, }