apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ .Chart.Name }}-{{ .Values.namespace }}
  namespace: {{ .Values.monitoring.namespace }}
  labels:
    app: bpap-{{ .Values.namespace }}
    relatedNamespace: {{ .Release.Namespace }}
spec:
  endpoints:
    - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
      interval: {{ .Values.global.bpAdminPortal.camunda.bpm.metrics.scrapeInterval }}
      path: {{ .Values.prometheusScrapePath }}
      scheme: http
      targetPort: {{ .Values.service.port }}
  jobLabel: app
  namespaceSelector:
    matchNames:
      - {{ .Values.namespace }}
  selector:
    matchExpressions:
      - key: app
        operator: In
        values:
        - {{ .Chart.Name }}
