{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.serviceMonitor.selfMonitor }}
apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default "monitoring.coreos.com") }}
kind: ServiceMonitor
metadata:
  name: {{ template "prometheus-operator.fullname" . }}-operator
  labels:
    app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
spec:
  endpoints:
  - port: http
    honorLabels: true
  selector:
    matchLabels:
      app: {{ template "prometheus-operator.name" . }}-operator
      release: {{ .Release.Name | quote }}
  namespaceSelector:
    matchNames:
      - {{ .Release.Namespace | quote }}
{{- end }}