{{- if .Values.webConfiguration }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "prometheus-pushgateway.fullname" . }}
  namespace: {{ include "prometheus-pushgateway.namespace" . }}
  labels:
    {{- include "prometheus-pushgateway.defaultLabels" . | nindent 4 }}
data:
  web-config.yaml: {{ include "prometheus-pushgateway.webConfiguration" . | b64enc}}
{{- end }}
---
{{- if and .Values.webConfiguration .Values.serviceMonitor.enabled (empty .Values.serviceMonitor.basicAuth) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "prometheus-pushgateway.fullname" . }}-basic-auth
  namespace: {{ default (include "prometheus-pushgateway.namespace" .) .Values.serviceMonitor.namespace }}
  labels:
    {{- include "prometheus-pushgateway.defaultLabels" . | nindent 4 }}
data:
  {{- include "prometheus-pushgateway.basicAuth" . | nindent 2 }}
type: Opaque
{{- end }}
