apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: pd
    cluster: {{ .Values.instance }}
  name: '{{ .Values.instance }}-pd'
  namespace: {{ .Values.namespace }}
spec:
  endpoints:
  - interval: 15s
    scrapeTimeout: 10s
    path: /metrics
    port: client
    relabelings:
    - sourceLabels: [namespace]
      action: replace
      targetLabel: kubernetes_namespace
    - sourceLabels: [node]
      action: replace
      targetLabel: kubernetes_node
    - sourceLabels: [pod]
      action: replace
      targetLabel: instance
    - sourceLabels: [app_kubernetes_io_component]
      action: replace
      targetLabel: component
  selector:
    matchLabels:
      app.kubernetes.io/component: pd
      app.kubernetes.io/instance: {{ .Values.instance }}
  targetLabels:
     - app.kubernetes.io/component

