From 3ece11f9e587061e9c76dc3b9e36d06188abbe84 Mon Sep 17 00:00:00 2001 From: Techassi Date: Thu, 10 Apr 2025 16:23:51 +0200 Subject: [PATCH 1/6] chore(template): Add Helm helper for telemetry env vars --- .../[[operator]]/templates/_telemetry.tpl | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 template/deploy/helm/[[operator]]/templates/_telemetry.tpl diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl new file mode 100644 index 00000000..196209f2 --- /dev/null +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl @@ -0,0 +1,51 @@ +{{/* +Create a list of telemetry related env vars. +*/}} +{{- define "telemetry.envVars" -}} +{{- with .Values.telemetry }} +{{- if not .consoleLogs.enabled }} +- name: NO_CONSOLE_OUTPUT + value: "true" +{{- end }} +{{- if .consoleLogs.level }} +- name: CONSOLE_LOG + value: {{ .consoleLogs.level }} +{{ end }} +{{- if .rollingFileLogs.enabled }} +- name: ROLLING_LOGS_DIR + value: /stackable/logs/{{ include "operator.appname" $ }} +{{- end }} +{{- if .rollingFileLogs.level }} +- name: FILE_LOG + value: info +{{- end }} +{{- if .rollingFileLogs.period }} +- name: ROLLING_LOGS_PERIOD + value: {{ .rollingFileLogs.period }} +{{- end }} +{{- if .otlpLogs.enabled }} +- name: OTLP_LOGS + value: "true" +{{- end }} +{{- if .otlpLogs.level }} +- name: OTLP_LOG + value: {{ .otlpLogs.level }} +{{- end }} +{{- if .otlpLogs.endpoint }} +- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT + value: {{ .otlpLogs.endpoint }} +{{- end }} +{{- if .otlpTraces.enabled }} +- name: OTLP_TRACES + value: "true" +{{- end }} +{{- if .otlpTraces.level }} +- name: OTLP_TRACE + value: {{ .otlpTraces.level }} +{{- end }} +{{- if .otlpTraces.endpoint }} +- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + value: {{ .otlpTraces.endpoint }} +{{- end }} +{{- end }} +{{- end }} From 023640295b44b1ff35875ce084208a56c05c825e Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 11 Apr 2025 14:19:50 +0200 Subject: [PATCH 2/6] chore(template): Update env vars in Helm helper --- .../[[operator]]/templates/_telemetry.tpl | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl index 196209f2..b0c74429 100644 --- a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl @@ -3,49 +3,49 @@ Create a list of telemetry related env vars. */}} {{- define "telemetry.envVars" -}} {{- with .Values.telemetry }} -{{- if not .consoleLogs.enabled }} -- name: NO_CONSOLE_OUTPUT +{{- if not .consoleLog.enabled }} +- name: CONSOLE_LOG_DISABLED value: "true" {{- end }} -{{- if .consoleLogs.level }} -- name: CONSOLE_LOG - value: {{ .consoleLogs.level }} +{{- if .consoleLog.level }} +- name: CONSOLE_LOG_LEVEL + value: {{ .consoleLog.level }} {{ end }} -{{- if .rollingFileLogs.enabled }} -- name: ROLLING_LOGS_DIR +{{- if .fileLog.enabled }} +- name: FILE_LOG_DIRECTORY value: /stackable/logs/{{ include "operator.appname" $ }} {{- end }} -{{- if .rollingFileLogs.level }} -- name: FILE_LOG +{{- if .fileLog.level }} +- name: FILE_LOG_LEVEL value: info {{- end }} -{{- if .rollingFileLogs.period }} -- name: ROLLING_LOGS_PERIOD - value: {{ .rollingFileLogs.period }} +{{- if .fileLog.rotationPeriod }} +- name: FILE_LOG_ROTATION_PERIOD + value: {{ .fileLog.rotationPeriod }} {{- end }} -{{- if .otlpLogs.enabled }} -- name: OTLP_LOGS +{{- if .otelLogExporter.enabled }} +- name: OTEL_LOG_EXPORTER_ENABLED value: "true" {{- end }} -{{- if .otlpLogs.level }} -- name: OTLP_LOG - value: {{ .otlpLogs.level }} +{{- if .otelLogExporter.level }} +- name: OTEL_LOG_EXPORTER_LEVEL + value: {{ .otelLogExporter.level }} {{- end }} -{{- if .otlpLogs.endpoint }} +{{- if .otelLogExporter.endpoint }} - name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT - value: {{ .otlpLogs.endpoint }} + value: {{ .otelLogExporter.endpoint }} {{- end }} -{{- if .otlpTraces.enabled }} -- name: OTLP_TRACES +{{- if .otelTraceExporter.enabled }} +- name: OTEL_TRACE_EXPORTER_ENABLED value: "true" {{- end }} -{{- if .otlpTraces.level }} -- name: OTLP_TRACE - value: {{ .otlpTraces.level }} +{{- if .otelTraceExporter.level }} +- name: OTEL_TRACE_EXPORTER_LEVEL + value: {{ .otelTraceExporter.level }} {{- end }} -{{- if .otlpTraces.endpoint }} +{{- if .otelTraceExporter.endpoint }} - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: {{ .otlpTraces.endpoint }} + value: {{ .otelTraceExporter.endpoint }} {{- end }} {{- end }} {{- end }} From 8ea0a00f2969699e5a993dd91184ea7e9d92b6a0 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 11 Apr 2025 14:20:17 +0200 Subject: [PATCH 3/6] chore(template): Add include directive to deployment template --- template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 index f690680f..2626c3f2 100644 --- a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 +++ b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 @@ -52,6 +52,7 @@ spec: - name: KUBERNETES_CLUSTER_DOMAIN value: {{ .Values.kubernetesClusterDomain | quote }} {{- end }} + {{- include "telemetry.envVars" . | nindent 12 }} {[% if operator.product_string in ['kafka'] %}] - name: KAFKA_BROKER_CLUSTERROLE value: {{ include "operator.fullname" . }}-kafka-broker-clusterrole From 6f599133c6bb52f9078e47b8c8624b9437ff4fc9 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 11 Apr 2025 14:35:55 +0200 Subject: [PATCH 4/6] fix: Remove hard-coded file log level --- template/deploy/helm/[[operator]]/templates/_telemetry.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl index b0c74429..135aba78 100644 --- a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl @@ -17,7 +17,7 @@ Create a list of telemetry related env vars. {{- end }} {{- if .fileLog.level }} - name: FILE_LOG_LEVEL - value: info + value: {{ .fileLog.level }} {{- end }} {{- if .fileLog.rotationPeriod }} - name: FILE_LOG_ROTATION_PERIOD From 972d9324bda6704b65a7662104f9a2a436bba4f6 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 11 Apr 2025 15:47:52 +0200 Subject: [PATCH 5/6] chore(template): Add console log format to helper --- template/deploy/helm/[[operator]]/templates/_telemetry.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl index 135aba78..888742dd 100644 --- a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl @@ -11,6 +11,10 @@ Create a list of telemetry related env vars. - name: CONSOLE_LOG_LEVEL value: {{ .consoleLog.level }} {{ end }} +{{- if .consoleLog.format }} +- name: CONSOLE_LOG_FORMAT + value: {{ .consoleLog.format }} +{{ end }} {{- if .fileLog.enabled }} - name: FILE_LOG_DIRECTORY value: /stackable/logs/{{ include "operator.appname" $ }} From 6d26a82505f1e10e070574085e95fb4db8252f86 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 11 Apr 2025 15:48:18 +0200 Subject: [PATCH 6/6] chore(template): Add file log max files to helper --- template/deploy/helm/[[operator]]/templates/_telemetry.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl index 888742dd..ec49f788 100644 --- a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl @@ -27,6 +27,10 @@ Create a list of telemetry related env vars. - name: FILE_LOG_ROTATION_PERIOD value: {{ .fileLog.rotationPeriod }} {{- end }} +{{- if .fileLog.maxFiles }} +- name: FILE_LOG_MAX_FILES + value: {{ .fileLog.maxFiles }} +{{- end }} {{- if .otelLogExporter.enabled }} - name: OTEL_LOG_EXPORTER_ENABLED value: "true"