{{- define "telemetry-values" }}

metrics:
  enabled: {{ .Values.metrics.enabled }}

{{- if index .Values "telemetry" "fluent-bit" }}
fluent-bit:
  {{- with index .Values.telemetry "fluent-bit" }}
  {{- toYaml . | nindent 2 }}
  {{- end }}

  serviceMonitor:
    enabled: {{ .Values.metrics.enabled }}
{{- end }}

{{- if .Values.telemetry.fluentd }}
fluentd:
  {{- with .Values.telemetry.fluentd }}
  {{- toYaml . | nindent 2 }}
  {{- end }}

  metrics:
    serviceMonitor:
      enabled: {{ .Values.metrics.enabled }}
{{- end }}

{{- if index .Values "telemetry" "data-prepper" }}
data-prepper:
  {{- with index .Values "telemetry" "data-prepper" }}
  {{- toYaml . | nindent 2 }}
  {{- end }}
{{- end }}

{{- if index .Values "telemetry" "opentelemetry-collector" }}
opentelemetry-collector:
  {{- with index .Values "telemetry" "opentelemetry-collector" }}
  {{- toYaml . | nindent 2 }}
  {{- end }}

  serviceMonitor:
    enabled: {{ .Values.metrics.enabled }}
{{- end }}

{{- if .Values.telemetry.jaeger }}
jaeger:
  {{- with .Values.telemetry.jaeger }}
  {{- toYaml . | nindent 2 }}
  {{- end }}

  collector:
    serviceMonitor:
      enabled: {{ .Values.metrics.enabled }}
  query:
    serviceMonitor:
      enabled: {{ .Values.metrics.enabled }}
{{- end }}

{{- if .Values.telemetry.opensearch }}
opensearch:
  {{- if .Values.telemetry.opensearch.nodeSets }}
  nodeSets:
    {{- with .Values.telemetry.opensearch.nodeSets }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- end }}

  {{- if .Values.telemetry.opensearch.dashboard }}
  dashboard:
    {{- with .Values.telemetry.opensearch.dashboard }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- end }}

  {{- with .Values.telemetry.opensearch.settings }}
  settings:
    {{- toYaml . | nindent 4 }}
  {{- end }}

  prometheus: {{ .Values.metrics.enabled }}

{{- end }}

{{- end }}


{{- define "telemetry-argo" }}

{{- end }}

{{ include "kubezero-app.app" . }}
