{{- if .Values.dataintegration.config.metrics.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: di-metrics
  labels:
    release: kubestack
spec:
  selector:
    matchLabels:
      app: di-metrics
  endpoints:
  - port: "http"
    interval: 30s  # How often Prometheus scrapes the target
    path: /metrics  # The endpoint where metrics are exposed
  {{- with .Values.dataintegration.config.metrics.additionalCustomConfig }}
  {{- toYaml . | nindent 2 }}
  {{- end }}
  namespaceSelector:
    matchNames:
      - {{ .Release.Namespace }}
{{- end}}