From 1d7c51a9053f1260e7c80155105488c87109d021 Mon Sep 17 00:00:00 2001 From: RAGOT David <35502263+Dav-14@users.noreply.github.com> Date: Fri, 24 May 2024 14:51:44 +0200 Subject: [PATCH] feat(agent): add configurable logging format (#1536) Co-authored-by: David Ragot --- ee/agent/.earthly/values.yaml | 5 +++++ ee/agent/helm/templates/_helpers.tpl | 7 +++++++ ee/agent/helm/templates/deployment.yaml | 1 + ee/agent/helm/values.yaml | 20 +++++++++++++------- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ee/agent/.earthly/values.yaml b/ee/agent/.earthly/values.yaml index 320faef3e0..35bff6ef41 100644 --- a/ee/agent/.earthly/values.yaml +++ b/ee/agent/.earthly/values.yaml @@ -1,3 +1,8 @@ +global: + monitoring: + logs: + format: "" + image: pullPolicy: Always diff --git a/ee/agent/helm/templates/_helpers.tpl b/ee/agent/helm/templates/_helpers.tpl index b60ef24daf..9d8e67386e 100644 --- a/ee/agent/helm/templates/_helpers.tpl +++ b/ee/agent/helm/templates/_helpers.tpl @@ -5,3 +5,10 @@ Selector labels app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{- define "agent.monitoring.logs" -}} +{{- if eq .Values.global.monitoring.logs.format "json" }} +- name: JSON_FORMATTING_LOGGER + value: "true" +{{- end }} +{{- end }} \ No newline at end of file diff --git a/ee/agent/helm/templates/deployment.yaml b/ee/agent/helm/templates/deployment.yaml index 5be9ee2698..e7dac95f40 100644 --- a/ee/agent/helm/templates/deployment.yaml +++ b/ee/agent/helm/templates/deployment.yaml @@ -65,6 +65,7 @@ spec: value: "{{ .Values.agent.baseUrl }}" - name: PRODUCTION value: "{{ .Values.agent.production }}" + {{- include "agent.monitoring.logs" . | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/ee/agent/helm/values.yaml b/ee/agent/helm/values.yaml index e92b3f1c5f..ff58b70cac 100644 --- a/ee/agent/helm/values.yaml +++ b/ee/agent/helm/values.yaml @@ -1,5 +1,10 @@ global: + # This is not a global value shared over all charts, but a global value shared over all templates in this chart. serviceName: agent + monitoring: + logs: + # format:Enum:{json, ""} + format: json image: repository: ghcr.io/formancehq/agent @@ -20,7 +25,8 @@ podAnnotations: {} podSecurityContext: {} # fsGroup: 2000 -securityContext: {} +securityContext: + {} # capabilities: # drop: # - ALL @@ -29,12 +35,12 @@ securityContext: {} # runAsUser: 1000 resources: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi nodeSelector: {}