apiVersion: operator.victoriametrics.com/v1beta1
kind: VMPodScrape
metadata:
  name: dm
  namespace: monitoring
  labels:
    scrape-by: kubernetes-o11y-vmagent-tempdisable
spec:
  selector:
    matchExpressions:
    - key: kubernetes.io/metadata.name
      operator: In
      values:
      - dm-*
  podMetricsEndpoints:
  - port: metrics
    interval: 30s
    scheme: http
    relabelConfigs:
      - sourceLabels: [__meta_kubernetes_namespace]
        regex: ^dm-(.+)$
        action: keep
      - sourceLabels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
        regex: "true"
        action: keep
      - sourceLabels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
        regex: (.+)
        targetLabel: __metrics_path__
      - sourceLabels: [__meta_kubernetes_pod_ip, __meta_kubernetes_pod_annotation_prometheus_io_port]
        regex: (.+);(.+)
        targetLabel: __address__
        action: replace
        replacement: $1:$2
      - sourceLabels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
        action: replace
        targetLabel: component
      - sourceLabels: [__meta_kubernetes_namespace]
        targetLabel: kubernetes_namespace
        action: replace
      - sourceLabels: [__meta_kubernetes_pod_name]
        targetLabel: instance
        action: replace
