{{- if .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "kubeinvaders.fullname" . }}
  labels:
    app.kubernetes.io/name: kubeinvaders
    helm.sh/chart: {{ include "kubeinvaders.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    {{- with .Values.additionalLabels }}
    {{- . | toYaml | nindent 4 }}
    {{- end }}
spec:
  endpoints:
    - port: http
  namespaceSelector: {}
  selector:
    matchLabels:
      app.kubernetes.io/name: kubeinvaders
      app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
