{{- if .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "garage-ui.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "garage-ui.labels" . | nindent 4 }}
    {{- with .Values.serviceMonitor.labels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
  selector:
    matchLabels:
      {{- include "garage-ui.selectorLabels" . | nindent 6 }}
  endpoints:
  - port: http
    path: {{ .Values.serviceMonitor.path }}
    interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
