apiVersion: v1
kind: ConfigMap
metadata:
 name: prometheus-config
data:
 prometheus.yml: |
  global:
  remote_write:
   - url: http://<cortex-server-ip>:9009/api/prom/push
  scrape_configs:
   - job_name: 'kubernetes-kube-state'
     kubernetes_sd_configs:
     - role: pod
     relabel_configs:
     - action: labelmap
       regex: __meta_kubernetes_pod_label_(.+)
     - source_labels: [__meta_kubernetes_namespace]
       action: replace
       target_label: kubernetes_namespace
     - source_labels: [__meta_kubernetes_pod_name]
       action: replace
       target_label: kubernetes_pod_name
     - source_labels: [__meta_kubernetes_pod_label_grafanak8sapp]
       regex: .*true.*
       action: keep
     - source_labels: ['__meta_kubernetes_pod_label_daemon', '__meta_kubernetes_pod_node_name']
       regex: 'node-exporter;(.*)'
       action: replace
       target_label: nodename
   - job_name: 'yugabytedb'
     metrics_path: /prometheus-metrics
     static_configs:
      - targets: ['yb-master-0.yb-masters.yb-demo.svc.cluster.local:7000', 'yb-master-1.yb-masters.yb-demo.svc.cluster.local:7000', 'yb-master-2.yb-masters.yb-demo.svc.cluster.local:7000']
        labels:
          group: 'yb-master'

      - targets: ['yb-tserver-0.yb-tservers.yb-demo.svc.cluster.local:9000', 'yb-tserver-1.yb-tservers.yb-demo.svc.cluster.local:9000', 'yb-tserver-2.yb-tservers.yb-demo.svc.cluster.local:9000']
        labels:
          group: 'yb-tserver'

      - targets: ['yb-tserver-0.yb-tservers.yb-demo.svc.cluster.local:11000', 'yb-tserver-1.yb-tservers.yb-demo.svc.cluster.local:11000', 'yb-tserver-2.yb-tservers.yb-demo.svc.cluster.local:11000']
        labels:
          group: 'yedis'

      - targets: ['yb-tserver-0.yb-tservers.yb-demo.svc.cluster.local:12000', 'yb-tserver-1.yb-tservers.yb-demo.svc.cluster.local:12000', 'yb-tserver-2.yb-tservers.yb-demo.svc.cluster.local:12000']
        labels:
          group: 'ycql'

      - targets: ['yb-tserver-0.yb-tservers.yb-demo.svc.cluster.local:13000', 'yb-tserver-1.yb-tservers.yb-demo.svc.cluster.local:13000', 'yb-tserver-2.yb-tservers.yb-demo.svc.cluster.local:13000']
        labels:
          group: 'ysql'