{{- if .Values.pulsar.enabled }}
{{- if .Values.pulsar.broker.podMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: {{ template "milvus.pulsar.fullname" . }}-broker
  namespace: {{ .Release.Namespace }}
  labels:
    app: pulsar
    cluster: {{ template "milvus.pulsar.fullname" .}}
    component: broker
spec:
  namespaceSelector:
    matchNames:
    - {{ .Release.Namespace }}
  podMetricsEndpoints:
  - interval: 30s
    path: /metrics
    port: http
    scheme: http
    scrapeTimeout: 30s
  selector:
    matchLabels:
      app: pulsar
      cluster: {{ template "milvus.pulsar.fullname" .}}
      component: broker
{{- end }}
{{- if .Values.pulsar.proxy.podMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: {{ template "milvus.pulsar.fullname" . }}-proxy
  namespace: {{ .Release.Namespace }}
  labels:
    app: pulsar
    cluster: {{ template "milvus.pulsar.fullname" .}}
    component: proxy
spec:
  namespaceSelector:
    matchNames:
    - {{ .Release.Namespace }}
  podMetricsEndpoints:
  - interval: 30s
    path: /metrics
    port: http
    scheme: http
    scrapeTimeout: 30s
  selector:
    matchLabels:
      app: pulsar
      cluster: {{ template "milvus.pulsar.fullname" .}}
      component: proxy
{{- end }}
{{- end }}
