Skip to content

Commit 1ba8fc4

Browse files
authored
chore(template): Add Helm helper for telemetry env vars (#501)
* chore(template): Add Helm helper for telemetry env vars * chore(template): Update env vars in Helm helper * chore(template): Add include directive to deployment template * fix: Remove hard-coded file log level * chore(template): Add console log format to helper * chore(template): Add file log max files to helper
1 parent 8f71d5d commit 1ba8fc4

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{/*
2+
Create a list of telemetry related env vars.
3+
*/}}
4+
{{- define "telemetry.envVars" -}}
5+
{{- with .Values.telemetry }}
6+
{{- if not .consoleLog.enabled }}
7+
- name: CONSOLE_LOG_DISABLED
8+
value: "true"
9+
{{- end }}
10+
{{- if .consoleLog.level }}
11+
- name: CONSOLE_LOG_LEVEL
12+
value: {{ .consoleLog.level }}
13+
{{ end }}
14+
{{- if .consoleLog.format }}
15+
- name: CONSOLE_LOG_FORMAT
16+
value: {{ .consoleLog.format }}
17+
{{ end }}
18+
{{- if .fileLog.enabled }}
19+
- name: FILE_LOG_DIRECTORY
20+
value: /stackable/logs/{{ include "operator.appname" $ }}
21+
{{- end }}
22+
{{- if .fileLog.level }}
23+
- name: FILE_LOG_LEVEL
24+
value: {{ .fileLog.level }}
25+
{{- end }}
26+
{{- if .fileLog.rotationPeriod }}
27+
- name: FILE_LOG_ROTATION_PERIOD
28+
value: {{ .fileLog.rotationPeriod }}
29+
{{- end }}
30+
{{- if .fileLog.maxFiles }}
31+
- name: FILE_LOG_MAX_FILES
32+
value: {{ .fileLog.maxFiles }}
33+
{{- end }}
34+
{{- if .otelLogExporter.enabled }}
35+
- name: OTEL_LOG_EXPORTER_ENABLED
36+
value: "true"
37+
{{- end }}
38+
{{- if .otelLogExporter.level }}
39+
- name: OTEL_LOG_EXPORTER_LEVEL
40+
value: {{ .otelLogExporter.level }}
41+
{{- end }}
42+
{{- if .otelLogExporter.endpoint }}
43+
- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
44+
value: {{ .otelLogExporter.endpoint }}
45+
{{- end }}
46+
{{- if .otelTraceExporter.enabled }}
47+
- name: OTEL_TRACE_EXPORTER_ENABLED
48+
value: "true"
49+
{{- end }}
50+
{{- if .otelTraceExporter.level }}
51+
- name: OTEL_TRACE_EXPORTER_LEVEL
52+
value: {{ .otelTraceExporter.level }}
53+
{{- end }}
54+
{{- if .otelTraceExporter.endpoint }}
55+
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
56+
value: {{ .otelTraceExporter.endpoint }}
57+
{{- end }}
58+
{{- end }}
59+
{{- end }}

template/deploy/helm/[[operator]]/templates/deployment.yaml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ spec:
5252
- name: KUBERNETES_CLUSTER_DOMAIN
5353
value: {{ .Values.kubernetesClusterDomain | quote }}
5454
{{- end }}
55+
{{- include "telemetry.envVars" . | nindent 12 }}
5556
{[% if operator.product_string in ['kafka'] %}]
5657
- name: KAFKA_BROKER_CLUSTERROLE
5758
value: {{ include "operator.fullname" . }}-kafka-broker-clusterrole

0 commit comments

Comments
 (0)