# grafana_charts_config-secret.yaml
{{- if and (.Values.loki.configAsSecret) (not .Values.loki.existingSecretForConfig) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "loki.fullname" . }}-config
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "loki.labels" . | nindent 4 }}
    {{- with .Values.loki.configSecretLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- with .Values.loki.configSecretAnnotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
stringData:
  config.yaml: |
    {{- tpl (mergeOverwrite (tpl .Values.loki.config . | fromYaml) .Values.loki.structuredConfig | toYaml) .  | nindent 4 }}
{{- end -}}