{{- if .Values.thanosRuler.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
  namespace: {{ template "kube-prometheus-stack.namespace" . }}
  labels:
    app: {{ include "kube-prometheus-stack.thanosRuler.name" . }}
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
data:
  {{- with .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig }}
  {{- if and .secret (not .existingSecret) }}
  alertmanager-configs.yaml: {{ toYaml .secret | b64enc | quote }}
  {{- end }}
  {{- end }}
  {{- with .Values.thanosRuler.thanosRulerSpec.objectStorageConfig }}
  {{- if and .secret (not .existingSecret) }}
  object-storage-configs.yaml: {{ toYaml .secret | b64enc | quote }}
  {{- end }}
  {{- end }}
  {{- with .Values.thanosRuler.thanosRulerSpec.queryConfig }}
  {{- if and .secret (not .existingSecret) }}
  query-configs.yaml: {{ toYaml .secret | b64enc | quote }}
  {{- end }}
  {{- end }}
{{- end }}
