From a86a1631659a5ae624cfa9353da3515ac0c34dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Fri, 15 Jan 2021 17:19:34 +0100 Subject: [PATCH] Fixes the unsolicited changes to the Schedule custom resource When global defaults for resource limits and requests were defined, the controller would add them to the user-provided Schedule instance. This has been remedied. --- handler/schedule.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handler/schedule.go b/handler/schedule.go index c62e50082..cbefcd78a 100644 --- a/handler/schedule.go +++ b/handler/schedule.go @@ -136,12 +136,12 @@ func (s *ScheduleHandler) mergeWithDefaults(specInstance *k8upv1alpha1.RunnableS func (s *ScheduleHandler) mergeResourcesWithDefaults(specInstance *k8upv1alpha1.RunnableSpec) { resources := &specInstance.Resources - if err := mergo.Merge(&s.schedule.Spec.ResourceRequirementsTemplate, cfg.Config.GetGlobalDefaultResources()); err != nil { - s.Log.Info("could not merge specific resources with global defaults", "err", err.Error(), "schedule", s.Obj.GetMetaObject().GetName(), "namespace", s.Obj.GetMetaObject().GetNamespace()) - } if err := mergo.Merge(resources, s.schedule.Spec.ResourceRequirementsTemplate); err != nil { s.Log.Info("could not merge specific resources with schedule defaults", "err", err.Error(), "schedule", s.Obj.GetMetaObject().GetName(), "namespace", s.Obj.GetMetaObject().GetNamespace()) } + if err := mergo.Merge(resources, cfg.Config.GetGlobalDefaultResources()); err != nil { + s.Log.Info("could not merge specific resources with global defaults", "err", err.Error(), "schedule", s.Obj.GetMetaObject().GetName(), "namespace", s.Obj.GetMetaObject().GetNamespace()) + } } func (s *ScheduleHandler) mergeBackendWithDefaults(specInstance *k8upv1alpha1.RunnableSpec) {