From 6fa5a14c20a2d5bdcf7e4a65c503e4507cd468e5 Mon Sep 17 00:00:00 2001 From: Eden Federman Date: Mon, 7 Oct 2024 09:38:25 +0300 Subject: [PATCH 1/2] Reduce ConfigMap reconcile on Instrumentor (#1565) --- .../controllers/startlangdetection/manager.go | 25 ++++++++++--------- instrumentor/main.go | 5 ++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/instrumentor/controllers/startlangdetection/manager.go b/instrumentor/controllers/startlangdetection/manager.go index 16b90af9c8..e39e88ad70 100644 --- a/instrumentor/controllers/startlangdetection/manager.go +++ b/instrumentor/controllers/startlangdetection/manager.go @@ -1,6 +1,7 @@ package startlangdetection import ( + "github.com/odigos-io/odigos/instrumentor/controllers/utils" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" ctrl "sigs.k8s.io/controller-runtime" @@ -59,18 +60,18 @@ func SetupWithManager(mgr ctrl.Manager) error { return err } - //err = builder. - // ControllerManagedBy(mgr). - // Named("startlangdetection-configmaps"). - // For(&corev1.ConfigMap{}). - // WithEventFilter(&utils.OnlyUpdatesPredicate{}). - // Complete(&OdigosConfigReconciler{ - // Client: mgr.GetClient(), - // Scheme: mgr.GetScheme(), - // }) - //if err != nil { - // return err - //} + err = builder. + ControllerManagedBy(mgr). + Named("startlangdetection-configmaps"). + For(&corev1.ConfigMap{}). + WithEventFilter(&utils.OnlyUpdatesPredicate{}). + Complete(&OdigosConfigReconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + }) + if err != nil { + return err + } return nil } diff --git a/instrumentor/main.go b/instrumentor/main.go index f892d17452..0dc8207932 100644 --- a/instrumentor/main.go +++ b/instrumentor/main.go @@ -20,6 +20,8 @@ import ( "flag" "os" + "github.com/odigos-io/odigos/k8sutils/pkg/env" + "github.com/odigos-io/odigos/instrumentor/controllers/instrumentationconfig" "github.com/odigos-io/odigos/instrumentor/controllers/startlangdetection" @@ -171,6 +173,9 @@ func main() { &corev1.Namespace{}: { Label: labels.Set{consts.OdigosInstrumentationLabel: consts.InstrumentationEnabled}.AsSelector(), }, + &corev1.ConfigMap{}: { + Field: client.InNamespace(env.GetCurrentNamespace()).AsSelector(), + }, }, }, }) From 5c72fb0e81dc02a22bac81eda4810f643e900e21 Mon Sep 17 00:00:00 2001 From: Eden Federman Date: Mon, 7 Oct 2024 10:17:11 +0300 Subject: [PATCH 2/2] Change memory limits of UI/Instrumentor/Scheduler/Autoscaler (#1569) This pull request includes several changes to increase the memory limits for various deployments in both the Go code and Helm templates. The most important changes are grouped by their themes: Go code adjustments and Helm template updates. ### Go Code Adjustments: * [`cli/cmd/resources/autoscaler.go`](diffhunk://#diff-7bae822a24a3402d4829c0f22fb8751207963f2ec6f1acfb3909dfb24e946ad6L470-R470): Increased memory limit from 128Mi to 512Mi in the `NewAutoscalerDeployment` function. * [`cli/cmd/resources/instrumentor.go`](diffhunk://#diff-811884a2ceb6f5d0f13a9a6f4273218bf54fdf7132b69291b9ba648e4242fe6fL504-R504): Increased memory limit from 128Mi to 512Mi in the `NewInstrumentorDeployment` function. * [`cli/cmd/resources/scheduler.go`](diffhunk://#diff-bdfed18f0b44f694d550d49331398f7131ad4ff76278ef68e0c772981e90d1e2L262-R262): Increased memory limit from 128Mi to 512Mi in the `NewSchedulerDeployment` function. * [`cli/cmd/resources/ui.go`](diffhunk://#diff-c286e10d34710a80a59127b2b7951e8a33d9b9554e47d2f2b827fd690f2e53abL97-R97): Increased memory limit from 128Mi to 512Mi in the `NewUIDeployment` function. ### Helm Template Updates: * [`helm/odigos/templates/autoscaler/deployment.yaml`](diffhunk://#diff-0716b0814249b7f1dbfb2a36387f298b24f56d6e40876833d3e4f7adf81a3760L58-R58): Increased memory limit from 128Mi to 512Mi. * [`helm/odigos/templates/instrumentor/deployment.yaml`](diffhunk://#diff-d67f2bcf36e3db81f9797f03be8c6cc9377374f27fdfd38a2b4896ab0b2c9984L61-R61): Increased memory limit from 128Mi to 512Mi. * [`helm/odigos/templates/scheduler/deployment.yaml`](diffhunk://#diff-6a89a4e953dbd0d108bcaa86ce93fd2a25149eaccf3df79bc964d7de486814c3L53-R53): Increased memory limit from 128Mi to 512Mi. * [`helm/odigos/templates/ui/deployment.yaml`](diffhunk://#diff-e029aabc8f82a9d10fd5dd6354d0f8b756c0d0d536509ddd441e9dc641cb27caL41-R41): Increased memory limit from 128Mi to 512Mi. --- cli/cmd/resources/autoscaler.go | 2 +- cli/cmd/resources/instrumentor.go | 2 +- cli/cmd/resources/scheduler.go | 2 +- cli/cmd/resources/ui.go | 2 +- helm/odigos/templates/autoscaler/deployment.yaml | 2 +- helm/odigos/templates/instrumentor/deployment.yaml | 2 +- helm/odigos/templates/scheduler/deployment.yaml | 2 +- helm/odigos/templates/ui/deployment.yaml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/cmd/resources/autoscaler.go b/cli/cmd/resources/autoscaler.go index a0047fa401..69c1aa99cf 100644 --- a/cli/cmd/resources/autoscaler.go +++ b/cli/cmd/resources/autoscaler.go @@ -467,7 +467,7 @@ func NewAutoscalerDeployment(ns string, version string, imagePrefix string, imag Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ "cpu": resource.MustParse("500m"), - "memory": *resource.NewQuantity(134217728, resource.BinarySI), + "memory": *resource.NewQuantity(536870912, resource.BinarySI), }, Requests: corev1.ResourceList{ "cpu": resource.MustParse("10m"), diff --git a/cli/cmd/resources/instrumentor.go b/cli/cmd/resources/instrumentor.go index 358a18c6ae..238363e0b1 100644 --- a/cli/cmd/resources/instrumentor.go +++ b/cli/cmd/resources/instrumentor.go @@ -501,7 +501,7 @@ func NewInstrumentorDeployment(ns string, version string, telemetryEnabled bool, Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ "cpu": resource.MustParse("500m"), - "memory": *resource.NewQuantity(134217728, resource.BinarySI), + "memory": *resource.NewQuantity(536870912, resource.BinarySI), }, Requests: corev1.ResourceList{ "cpu": resource.MustParse("10m"), diff --git a/cli/cmd/resources/scheduler.go b/cli/cmd/resources/scheduler.go index 6cdf42be51..2b8bbc35fe 100644 --- a/cli/cmd/resources/scheduler.go +++ b/cli/cmd/resources/scheduler.go @@ -259,7 +259,7 @@ func NewSchedulerDeployment(ns string, version string, imagePrefix string) *apps Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ "cpu": resource.MustParse("500m"), - "memory": *resource.NewQuantity(134217728, resource.BinarySI), + "memory": *resource.NewQuantity(536870912, resource.BinarySI), }, Requests: corev1.ResourceList{ "cpu": resource.MustParse("10m"), diff --git a/cli/cmd/resources/ui.go b/cli/cmd/resources/ui.go index dbd8bc6e63..6cd464c231 100644 --- a/cli/cmd/resources/ui.go +++ b/cli/cmd/resources/ui.go @@ -94,7 +94,7 @@ func NewUIDeployment(ns string, version string, imagePrefix string) *appsv1.Depl Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ "cpu": resource.MustParse("500m"), - "memory": *resource.NewQuantity(134217728, resource.BinarySI), + "memory": *resource.NewQuantity(536870912, resource.BinarySI), }, Requests: corev1.ResourceList{ "cpu": resource.MustParse("10m"), diff --git a/helm/odigos/templates/autoscaler/deployment.yaml b/helm/odigos/templates/autoscaler/deployment.yaml index 93e4242624..f7ccf419ed 100644 --- a/helm/odigos/templates/autoscaler/deployment.yaml +++ b/helm/odigos/templates/autoscaler/deployment.yaml @@ -55,7 +55,7 @@ spec: resources: limits: cpu: 500m - memory: 128Mi + memory: 512Mi requests: cpu: 10m memory: 64Mi diff --git a/helm/odigos/templates/instrumentor/deployment.yaml b/helm/odigos/templates/instrumentor/deployment.yaml index 6093737de6..43c106181f 100644 --- a/helm/odigos/templates/instrumentor/deployment.yaml +++ b/helm/odigos/templates/instrumentor/deployment.yaml @@ -58,7 +58,7 @@ spec: resources: limits: cpu: 500m - memory: 128Mi + memory: 512Mi requests: cpu: 10m memory: 64Mi diff --git a/helm/odigos/templates/scheduler/deployment.yaml b/helm/odigos/templates/scheduler/deployment.yaml index b238f38767..081d8d6e6b 100644 --- a/helm/odigos/templates/scheduler/deployment.yaml +++ b/helm/odigos/templates/scheduler/deployment.yaml @@ -50,7 +50,7 @@ spec: resources: limits: cpu: 500m - memory: 128Mi + memory: 512Mi requests: cpu: 10m memory: 64Mi diff --git a/helm/odigos/templates/ui/deployment.yaml b/helm/odigos/templates/ui/deployment.yaml index b071a71033..12a363e85a 100644 --- a/helm/odigos/templates/ui/deployment.yaml +++ b/helm/odigos/templates/ui/deployment.yaml @@ -38,7 +38,7 @@ spec: resources: limits: cpu: 500m - memory: 128Mi + memory: 512Mi requests: cpu: 10m memory: 64Mi