From 257e598ff2d533601b07d1769fcea0f800c827a7 Mon Sep 17 00:00:00 2001
From: andrei_skorkin <andrei_skorkin@epam.com>
Date: Fri, 23 Jun 2023 09:08:25 +0200
Subject: [PATCH] add global variable limitsEnabled

---
 devops/gc/deploy/README.md                   | 5 +++--
 devops/gc/deploy/templates/legal-deploy.yaml | 2 ++
 devops/gc/deploy/values.yaml                 | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/devops/gc/deploy/README.md b/devops/gc/deploy/README.md
index 2bb16b416..613e08824 100644
--- a/devops/gc/deploy/README.md
+++ b/devops/gc/deploy/README.md
@@ -99,6 +99,7 @@ First you need to set variables in **values.yaml** file using any code editor. S
 **global.domain** | your domain for the external endpoint, ex `example.com` | string | - | yes
 **global.onPremEnabled** | whether on-prem is enabled | boolean | false | yes
 **global.dataBootstrapEnabled** | whether bootstrap is enabled | boolean | false | yes
+**global.limitsEnabled** | whether CPU and memory limits are enabled | boolean | true | yes
 
 ### Configmap variables
 
@@ -118,8 +119,8 @@ First you need to set variables in **values.yaml** file using any code editor. S
 |------|-------------|------|---------|---------|
 **data.requestsCpu** | amount of requests CPU | string | 10m | yes
 **data.requestsMemory** | amount of requests memory| string | 550Mi | yes
-**data.limitsCpu** | CPU limit | string | 1 | yes
-**data.limitsMemory** | memory limit | string | 1G | yes
+**data.limitsCpu** | CPU limit | string | 1 | only if `global.limitsEnabled` is true
+**data.limitsMemory** | memory limit | string | 1G | only if `global.limitsEnabled` is true
 **data.bootstrapImage** | name of the bootstrap image | string | - | yes
 **data.bootstrapServiceAccountName** | name of the bootstrap service account | string | - | yes
 **data.serviceAccountName** | name of your service account | string | legal | yes
diff --git a/devops/gc/deploy/templates/legal-deploy.yaml b/devops/gc/deploy/templates/legal-deploy.yaml
index bf00c3812..4a15a0b37 100644
--- a/devops/gc/deploy/templates/legal-deploy.yaml
+++ b/devops/gc/deploy/templates/legal-deploy.yaml
@@ -45,7 +45,9 @@ spec:
           requests:
             cpu: {{ .Values.data.requestsCpu | quote }}
             memory: {{ .Values.data.requestsMemory | quote }}
+          {{- if .Values.global.limitsEnabled }}
           limits:
             cpu: {{ .Values.data.limitsCpu | quote }}
             memory: {{ .Values.data.limitsMemory | quote }}
+          {{- end }}
       serviceAccountName: {{ .Values.data.serviceAccountName | quote }}
diff --git a/devops/gc/deploy/values.yaml b/devops/gc/deploy/values.yaml
index b4f04a3da..4e90607ca 100644
--- a/devops/gc/deploy/values.yaml
+++ b/devops/gc/deploy/values.yaml
@@ -6,6 +6,7 @@ global:
   domain: ""
   onPremEnabled: false
   dataBootstrapEnabled: false
+  limitsEnabled: true
 
 data:
   # configmaps
-- 
GitLab