apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-server-conf
  labels:
    name: prometheus-server-conf
  namespace: cnp-monitoring
data:
  prometheus.yml: |-
    global:
      scrape_interval:     15s # By default, scrape targets every 15 seconds.

      # Attach these labels to any time series or alerts when communicating with
      # external systems (federation, remote storage, Alertmanager).
      external_labels:
        monitor: 'cnp-monitor'

    # A scrape configuration containing exactly one endpoint to scrape:
    # Here it's Prometheus itself.
    scrape_configs:
      # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
      - job_name: 'prometheus'
        # Override the global default and scrape targets from this job every 5 seconds.
        scrape_interval: 5s
        static_configs:
          - targets: ['localhost:9090']
      
      - job_name: 'linkerd'
        kubernetes_sd_configs:
        - role: pod
          namespaces:
            names: ['linkerd']

        relabel_configs:
        - source_labels:
          - __meta_kubernetes_pod_container_name
          action: keep
          regex: ^prometheus$

        honor_labels: true
        metrics_path: '/federate'

        params:
          'match[]':
            - '{job="linkerd-proxy"}'
            - '{job="linkerd-controller"}'

      - job_name: 'kong'
        scrape_interval: 5s
        static_configs:
          - targets: ['kong-ingress-controller.kong.svc.cluster.local:8001']