diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl new file mode 100644 index 00000000..ec49f788 --- /dev/null +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl @@ -0,0 +1,59 @@ +{{/* +Create a list of telemetry related env vars. +*/}} +{{- define "telemetry.envVars" -}} +{{- with .Values.telemetry }} +{{- if not .consoleLog.enabled }} +- name: CONSOLE_LOG_DISABLED + value: "true" +{{- end }} +{{- if .consoleLog.level }} +- 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" $ }} +{{- end }} +{{- if .fileLog.level }} +- name: FILE_LOG_LEVEL + value: {{ .fileLog.level }} +{{- end }} +{{- if .fileLog.rotationPeriod }} +- 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" +{{- end }} +{{- if .otelLogExporter.level }} +- name: OTEL_LOG_EXPORTER_LEVEL + value: {{ .otelLogExporter.level }} +{{- end }} +{{- if .otelLogExporter.endpoint }} +- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT + value: {{ .otelLogExporter.endpoint }} +{{- end }} +{{- if .otelTraceExporter.enabled }} +- name: OTEL_TRACE_EXPORTER_ENABLED + value: "true" +{{- end }} +{{- if .otelTraceExporter.level }} +- name: OTEL_TRACE_EXPORTER_LEVEL + value: {{ .otelTraceExporter.level }} +{{- end }} +{{- if .otelTraceExporter.endpoint }} +- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + value: {{ .otelTraceExporter.endpoint }} +{{- end }} +{{- end }} +{{- end }} 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