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

---
 devops/gc/deploy/README.md                    | 33 ++++++++++---------
 .../gc/deploy/templates/legal-configmap.yaml  |  2 +-
 devops/gc/deploy/values.yaml                  |  3 +-
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/devops/gc/deploy/README.md b/devops/gc/deploy/README.md
index b793d15f8..ef436cb69 100644
--- a/devops/gc/deploy/README.md
+++ b/devops/gc/deploy/README.md
@@ -97,39 +97,40 @@ 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.acceptHttp** | accept Http traffic | string | true | yes
-**data.entitlementsHost** | Entitlements host URL | string | <http://entitlements> | yes
-**data.defaultLegalTag** | Default legal tag | string | default-data-tag| yes
-**data.legalHost** | Legal host URL | string | <http://legal> | yes
+**data.logLevel** | logging severity level for this service only  | string | - | yes, only if differs from the `global.logLevel`
+**data.acceptHttp** | accept Http traffic | string | `true` | yes
+**data.entitlementsHost** | Entitlements host URL | string | `http://entitlements` | yes
+**data.defaultLegalTag** | Default legal tag | string | `default-data-tag` | yes
+**data.legalHost** | Legal host URL | string | `http://legal` | yes
 
 ### Deployment variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
-**data.requestsCpu** | amount of requests CPU | string | 10m | yes
-**data.requestsMemory** | amount of requests memory| string | 550Mi | 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.requestsCpu** | amount of requests CPU | string | `10m` | yes
+**data.requestsMemory** | amount of requests memory| string | `550Mi` | 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.cronJobServiceAccountName** | name of the service account used in cronjob | string | - | yes
-**data.serviceAccountName** | name of your service account | string | legal | yes
-**data.imagePullPolicy** | when to pull the image | string | IfNotPresent | yes
+**data.serviceAccountName** | name of your service account | string | `legal` | yes
+**data.imagePullPolicy** | when to pull the image | string | `IfNotPresent` | yes
 **data.image** | path to the image in a registry | string | - | yes
 
 ### Configuration variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
-**conf.configmap** | configmap to be used | string | legal-config | yes
-**conf.appName** | name of the app | string | legal | yes
-**conf.replicas** | Number of pods for service  | integer | 1 | yes
+**conf.configmap** | configmap to be used | string | `legal-config` | yes
+**conf.appName** | name of the app | string | `legal` | yes
+**conf.replicas** | Number of pods for service  | integer | `1` | yes
 
 ### Istio variables
 
diff --git a/devops/gc/deploy/templates/legal-configmap.yaml b/devops/gc/deploy/templates/legal-configmap.yaml
index df7fdb59a..3499f1ddc 100644
--- a/devops/gc/deploy/templates/legal-configmap.yaml
+++ b/devops/gc/deploy/templates/legal-configmap.yaml
@@ -7,5 +7,5 @@ metadata:
   namespace: {{ .Release.Namespace | quote }}
 data:
   ACCEPT_HTTP: {{ .Values.data.acceptHttp | quote }}
-  LOG_LEVEL: {{ .Values.data.logLevel | quote }}
+  LOG_LEVEL: {{ .Values.data.logLevel | default .Values.global.logLevel | quote }}
   SPRING_PROFILES_ACTIVE: "gcp"
diff --git a/devops/gc/deploy/values.yaml b/devops/gc/deploy/values.yaml
index b1000bf5d..b58e84f46 100644
--- a/devops/gc/deploy/values.yaml
+++ b/devops/gc/deploy/values.yaml
@@ -6,10 +6,11 @@ global:
   domain: ""
   onPremEnabled: false
   limitsEnabled: true
+  logLevel: "ERROR"
 
 data:
   # configmaps
-  logLevel: "ERROR"
+  logLevel: ""
   acceptHttp: "true"
   entitlementsHost: "http://entitlements"
   defaultLegalTag: "default-data-tag"
-- 
GitLab