# grafana_charts_metrics-instance-usernames-secret.yaml
{{- if .Values.metaMonitoring.grafanaAgent.enabled }}
{{- with .Values.metaMonitoring.grafanaAgent.metrics }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "tempo.resourceName" (dict "ctx" $ "component" "metrics-instance-usernames") }}
  namespace: {{ $.Values.metaMonitoring.grafanaAgent.namespace | default $.Release.Namespace | quote }}
  labels:
    {{- include "tempo.labels" (dict "ctx" $ "component" "meta-monitoring") | nindent 4 }}
data:
  {{- range $i, $cfg := prepend (.additionalRemoteWriteConfigs | default list) .remote }}
  {{- if (($cfg).auth).username }}
  username-{{ $i }}: {{ $cfg.auth.username | b64enc | quote }}
  {{- end }}
  {{- end }}
{{- end }}
{{- end }}