From b31f5f3e1e9a93faace0a1f2a5ec8652d493dcfc Mon Sep 17 00:00:00 2001
From: "Vadzim Beuzo  [EPAM / GCP]" <vadzim_beuzo@epam.com>
Date: Tue, 3 Sep 2024 16:21:43 +0000
Subject: [PATCH] GONRG-10103: add global log level to services

---
 devops/gc/deploy/README.md                    | 20 +++++++++----------
 devops/gc/deploy/templates/unit-variables.yml |  2 +-
 devops/gc/deploy/values.yaml                  |  3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/devops/gc/deploy/README.md b/devops/gc/deploy/README.md
index 69c8d6c6..b1e7858b 100644
--- a/devops/gc/deploy/README.md
+++ b/devops/gc/deploy/README.md
@@ -31,33 +31,33 @@ First you need to set variables in **values.yaml** file using any code editor. S
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
 **global.domain** | your domain for the external endpoint, ex `example.com` | string | - | yes
-**global.onPremEnabled** | whether on-prem is enabled | boolean | false | yes
-**global.limitsEnabled** | whether CPU and memory limits are enabled | boolean | true | yes
+**global.onPremEnabled** | whether on-prem is enabled | boolean | `false` | yes
+**global.limitsEnabled** | whether CPU and memory limits are enabled | boolean | `true` | yes
+**global.logLevel** | severity of logging level | string | `ERROR` | yes
 
 ### Configmap variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
-**data.logLevel** | logging level | string | ERROR | yes
+**data.logLevel** | logging severity level for this service only  | string | - | yes, only if differs from the `global.logLevel`
 **data.entitlementsHost** | entitlements service host address | string | `http://entitlements` | yes
 
 ### Deployment variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
-**data.requestsCpu** | amount of requested CPU | string | 10m | yes
-**data.requestsMemory** | amount of requested memory| string | 350Mi | 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.serviceAccountName** | name of your service account | string | unit | yes
-**data.imagePullPolicy** | when to pull image | string | IfNotPresent | yes
+**data.requestsCpu** | amount of requested CPU | string | `10m` | yes
+**data.requestsMemory** | amount of requested memory| string | `350Mi` | 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.serviceAccountName** | name of your service account | string | `unit` | yes
+**data.imagePullPolicy** | when to pull image | string | `IfNotPresent` | yes
 **data.image** | service image | string | - | yes
 
 ### Config variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
-
 **conf.appName** | name of the app | string | `unit` | yes
 **conf.configmap** | configmap to be used | string | `unit-config` | yes
 
diff --git a/devops/gc/deploy/templates/unit-variables.yml b/devops/gc/deploy/templates/unit-variables.yml
index 3c2b1223..aa30dd20 100644
--- a/devops/gc/deploy/templates/unit-variables.yml
+++ b/devops/gc/deploy/templates/unit-variables.yml
@@ -6,5 +6,5 @@ metadata:
   name:  {{ .Values.conf.configmap | quote }}
   namespace: {{ .Release.Namespace | quote }}
 data:
-  LOG_LEVEL: {{ .Values.data.logLevel | quote }}
+  LOG_LEVEL: {{ .Values.data.logLevel | default .Values.global.logLevel | quote }}
   ENTITLEMENTS_HOST: {{ .Values.data.entitlementsHost | quote }}
diff --git a/devops/gc/deploy/values.yaml b/devops/gc/deploy/values.yaml
index 672caa56..caa2c2e4 100644
--- a/devops/gc/deploy/values.yaml
+++ b/devops/gc/deploy/values.yaml
@@ -6,9 +6,10 @@ global:
   domain: ""
   onPremEnabled: false
   limitsEnabled: true
+  logLevel: "ERROR"
 
 data:
-  logLevel: "ERROR"
+  logLevel: ""
   entitlementsHost: "http://entitlements"
   requestsCpu: "5m"
   requestsMemory: "275Mi"
-- 
GitLab