From 151ffd337c8feb91efb9e0c0fa850cd9d8ba3ec7 Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Tue, 29 Oct 2024 14:49:38 +0300 Subject: [PATCH] fix: merge cronjob config Signed-off-by: Vladislav Sukhin --- .../controller/testworkflows/testworkflow_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controller/testworkflows/testworkflow_controller.go b/internal/controller/testworkflows/testworkflow_controller.go index 43211c5..2e39332 100644 --- a/internal/controller/testworkflows/testworkflow_controller.go +++ b/internal/controller/testworkflows/testworkflow_controller.go @@ -30,6 +30,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" @@ -242,6 +243,11 @@ func MergeCronJobJobConfig(dst, include *testworkflowsv1.CronJobConfig) *testwor } maps.Copy(dst.Annotations, include.Annotations) + if len(include.Config) > 0 && dst.Config == nil { + dst.Config = map[string]intstr.IntOrString{} + } + maps.Copy(dst.Config, include.Config) + return dst }