charts/k8up/templates/prometheus/servicemonitor.yaml

Summary

Maintainability
Test Coverage
{{- if .Values.metrics.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "k8up.fullname" . }}-monitor
  namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace }}
  labels:
    {{- include "k8up.labels" . | nindent 4 }}
    {{- with .Values.metrics.serviceMonitor.additionalLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
  endpoints:
    - port: http
      interval: {{ .Values.metrics.serviceMonitor.scrapeInterval }}
  selector:
    matchLabels:
      {{- include "k8up.selectorLabels" . | nindent 6 }}
  {{- if .Values.metrics.serviceMonitor.namespace }}
  namespaceSelector:
    matchNames:
      - {{ .Release.Namespace }}
  {{- end }}
{{- end }}