From e3b8a9cf9fdc527db8ade65d2d6e6c49755faf87 Mon Sep 17 00:00:00 2001 From: Horiodino Date: Thu, 19 Sep 2024 21:05:02 +0530 Subject: [PATCH] added memoryLimit_field_under_registry_operator #1429 Signed-off-by: Horiodino --- controllers/update.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/controllers/update.go b/controllers/update.go index 0d13a30..df04d49 100644 --- a/controllers/update.go +++ b/controllers/update.go @@ -27,6 +27,7 @@ import ( corev1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -61,6 +62,15 @@ func (r *DevfileRegistryReconciler) updateDeployment(ctx context.Context, cr *re } } + if indexImageContainer.Resources.Limits.Memory().String() != cr.Spec.DevfileIndex.MemoryLimit { + memoryLimit, err := resource.ParseQuantity(cr.Spec.DevfileIndex.MemoryLimit) + if err != nil { + r.Log.Error(err, "Error parsing memory limit") + } + indexImageContainer.Resources.Limits[corev1.ResourceMemory] = memoryLimit + needsUpdating = true + } + ociImage := registry.GetOCIRegistryImage(cr) ociImageContainer := dep.Spec.Template.Spec.Containers[1] if ociImageContainer.Image != ociImage {