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 {