From b34b86880113b69840ad1a12f23d0dde62b52373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Falc=C3=A3o?= Date: Mon, 22 Aug 2022 12:08:43 -0300 Subject: [PATCH] Add resources specification to fm-rest-api Some pods are being evicted due to some containers exceeding the usage of a specific resource. The goal of this change is to be able to specify values of limits and requests for fm-rest-api pods. In this way we can make sure that the system has the necessary resources to support the api. Test Plan: PASS: Check that with the 'enabled' flag set to 'false' no values of requests and limits are specified. PASS: Check that with the 'enabled' flag set to 'true' the default values of requests and limits takes place. PASS: Override the default value of requests/limits and set the 'enabled' flag to 'true' and check that the new value takes place in the description of the pod. Partial-bug: 1970645 Signed-off-by: Rafael Falcao Change-Id: I8a247c09643303f80a61b989d4b82c3835b7e601 --- .../helm-charts/fm-rest-api/templates/deployment.yaml | 3 +-- .../fm-rest-api/helm-charts/fm-rest-api/values.yaml | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/deployment.yaml b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/deployment.yaml index ba15f17..c591009 100755 --- a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/deployment.yaml +++ b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/deployment.yaml @@ -40,6 +40,7 @@ spec: {{ tuple $envAll "fmapi" $mounts_fm_rest_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: fm-rest-api +{{ tuple $envAll $envAll.Values.pod.resources.fm | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} env: - name: RUNNING_IN_CONTAINER value: "True" @@ -74,8 +75,6 @@ spec: - name: http containerPort: 18003 protocol: TCP - resources: -{{ toYaml .Values.resources | indent 12 }} nodeSelector: {{ .Values.labels.fm_api.node_selector_key }}: {{ .Values.labels.fm_api.node_selector_value }} {{ if $envAll.Values.pod.tolerations.fm.enabled }} diff --git a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml index 63e2802..0ac1c6a 100644 --- a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml +++ b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml @@ -326,6 +326,14 @@ pod: fm: timeout: 30 resources: + enabled: false + fm: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" jobs: ks_endpoints: requests: