From 205314e3633b384fd7836a1eafa26552df3f2dd2 Mon Sep 17 00:00:00 2001 From: Hadi Abbasi Date: Thu, 11 Apr 2024 18:45:52 +0330 Subject: [PATCH 1/2] set GOMAXPROCS and GOMEMLIMIT vars if applied, set GOMAXPROCS and GOMEMLIMIT for all controllers based on container resources which leads to reduce throttling and better performance Signed-off-by: Hadi Abbasi --- manifests/install/kustomization.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/manifests/install/kustomization.yaml b/manifests/install/kustomization.yaml index edce8ca840..f1eabdc6cf 100644 --- a/manifests/install/kustomization.yaml +++ b/manifests/install/kustomization.yaml @@ -26,3 +26,23 @@ images: newName: ghcr.io/fluxcd/image-reflector-controller - name: fluxcd/image-automation-controller newName: ghcr.io/fluxcd/image-automation-controller +patches: + - patch: | + - op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu + - op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory + target: + kind: Deployment From 26168b12416acf4c5cb0162831472f0a12fa5e95 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 12 Apr 2024 13:32:06 +0300 Subject: [PATCH 2/2] Set `GOMAXPROCS` and `GOMEMLIMIT` for bootstrap Signed-off-by: Stefan Prodan --- manifests/bases/helm-controller/patch.yaml | 16 +++++++++++++++ .../image-automation-controller/patch.yaml | 16 +++++++++++++++ .../image-reflector-controller/patch.yaml | 16 +++++++++++++++ .../bases/kustomize-controller/patch.yaml | 16 +++++++++++++++ .../bases/notification-controller/patch.yaml | 16 +++++++++++++++ manifests/bases/source-controller/patch.yaml | 16 +++++++++++++++ manifests/install/kustomization.yaml | 20 ------------------- 7 files changed, 96 insertions(+), 20 deletions(-) diff --git a/manifests/bases/helm-controller/patch.yaml b/manifests/bases/helm-controller/patch.yaml index 79773699fc..17f163d22e 100644 --- a/manifests/bases/helm-controller/patch.yaml +++ b/manifests/bases/helm-controller/patch.yaml @@ -7,3 +7,19 @@ - op: add path: /spec/template/spec/priorityClassName value: system-cluster-critical +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory diff --git a/manifests/bases/image-automation-controller/patch.yaml b/manifests/bases/image-automation-controller/patch.yaml index 63d261ed12..73d0d8c73b 100644 --- a/manifests/bases/image-automation-controller/patch.yaml +++ b/manifests/bases/image-automation-controller/patch.yaml @@ -4,3 +4,19 @@ - op: add path: /spec/template/spec/serviceAccountName value: image-automation-controller +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory diff --git a/manifests/bases/image-reflector-controller/patch.yaml b/manifests/bases/image-reflector-controller/patch.yaml index 1db56bf2af..4f3e4a7f53 100644 --- a/manifests/bases/image-reflector-controller/patch.yaml +++ b/manifests/bases/image-reflector-controller/patch.yaml @@ -4,3 +4,19 @@ - op: add path: /spec/template/spec/serviceAccountName value: image-reflector-controller +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory diff --git a/manifests/bases/kustomize-controller/patch.yaml b/manifests/bases/kustomize-controller/patch.yaml index 6ce23139f1..7645b6849e 100644 --- a/manifests/bases/kustomize-controller/patch.yaml +++ b/manifests/bases/kustomize-controller/patch.yaml @@ -7,3 +7,19 @@ - op: add path: /spec/template/spec/priorityClassName value: system-cluster-critical +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory diff --git a/manifests/bases/notification-controller/patch.yaml b/manifests/bases/notification-controller/patch.yaml index 9c36ccdda5..fe3be22878 100644 --- a/manifests/bases/notification-controller/patch.yaml +++ b/manifests/bases/notification-controller/patch.yaml @@ -1,3 +1,19 @@ - op: add path: /spec/template/spec/serviceAccountName value: notification-controller +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory diff --git a/manifests/bases/source-controller/patch.yaml b/manifests/bases/source-controller/patch.yaml index e55604ee63..1420c8e1bd 100644 --- a/manifests/bases/source-controller/patch.yaml +++ b/manifests/bases/source-controller/patch.yaml @@ -7,3 +7,19 @@ - op: add path: /spec/template/spec/priorityClassName value: system-cluster-critical +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMAXPROCS + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.cpu +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + containerName: manager + resource: limits.memory diff --git a/manifests/install/kustomization.yaml b/manifests/install/kustomization.yaml index f1eabdc6cf..edce8ca840 100644 --- a/manifests/install/kustomization.yaml +++ b/manifests/install/kustomization.yaml @@ -26,23 +26,3 @@ images: newName: ghcr.io/fluxcd/image-reflector-controller - name: fluxcd/image-automation-controller newName: ghcr.io/fluxcd/image-automation-controller -patches: - - patch: | - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: GOMAXPROCS - valueFrom: - resourceFieldRef: - containerName: manager - resource: limits.cpu - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: GOMEMLIMIT - valueFrom: - resourceFieldRef: - containerName: manager - resource: limits.memory - target: - kind: Deployment