#@ load("@ytt:data", "data")
---
server:
  resources:
    requests:
      cpu: 100m
      memory: 256Mi
    limits:
      memory: 512Mi
  persistentVolume:
    enabled: true
    size: 10Gi
    storageClassName: #@ data.values.cluster.storageClass.local
  scrape:
    enabled: true
    config:
      global:
        scrape_interval: 30s
        scrape_timeout: 10s
        external_labels:
          cluster: k8s-and-chill
      scrape_configs:
        - job_name: victoriametrics
          static_configs:
            - targets: ["localhost:8428"]
        - job_name: node-exporter
          kubernetes_sd_configs:
            - role: endpoints
          relabel_configs:
            - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: monitoring;prometheus-node-exporter;metrics
        - job_name: kube-state-metrics
          kubernetes_sd_configs:
            - role: endpoints
          relabel_configs:
            - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: monitoring;kube-state-metrics;http
        - job_name: kubelet
          kubernetes_sd_configs:
            - role: node
          scheme: https
          tls_config:
            ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
            insecure_skip_verify: true
          bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
          relabel_configs:
            - action: labelmap
              regex: __meta_kubernetes_node_label_(.+)
        - job_name: kubelet-cadvisor
          kubernetes_sd_configs:
            - role: node
          scheme: https
          tls_config:
            ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
            insecure_skip_verify: true
          bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
          metrics_path: /metrics/cadvisor
          relabel_configs:
            - action: labelmap
              regex: __meta_kubernetes_node_label_(.+)
        - job_name: traefik
          kubernetes_sd_configs:
            - role: endpoints
          relabel_configs:
            - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: traefik;traefik;metrics
        - job_name: argocd
          kubernetes_sd_configs:
            - role: endpoints
          relabel_configs:
            - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: argocd;http-metrics
        - job_name: cert-manager
          kubernetes_sd_configs:
            - role: endpoints
          relabel_configs:
            - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: cert-manager;cert-manager;tcp-prometheus-servicemonitor
        - job_name: ocis
          kubernetes_sd_configs:
            - role: endpoints
              namespaces:
                names: [ocis]
          relabel_configs:
            - source_labels: [__meta_kubernetes_service_label_ocis_metrics, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: enabled;metrics-debug
            - source_labels: [__meta_kubernetes_service_name]
              target_label: ocis_service
            - source_labels: [__meta_kubernetes_pod_name]
              target_label: pod
        - job_name: synapse
          metrics_path: /_synapse/metrics
          kubernetes_sd_configs:
            - role: endpoints
              namespaces:
                names: [matrix]
          relabel_configs:
            - source_labels: [__meta_kubernetes_service_label_matrix_metrics, __meta_kubernetes_endpoint_port_name]
              action: keep
              regex: enabled;metrics
            - source_labels: [__meta_kubernetes_pod_name]
              target_label: pod
            - target_label: index
              replacement: "0"
