apiVersion: v1
kind: ConfigMap
metadata:
  name: event-exporter-cfg
  namespace: monitoring
data:
  config.yaml: |
    logLevel: error
    logFormat: json
    throttlePeriod: 10
    kubeQPS: 60
    kubeBurst: 60
    route:
      routes:
        - match:
            - namespacelabels:
                app.kubernetes.io/managed-by: test-infra
              receiver: "loki"
        - match:
            - namespace: "test-infra$|kube-system|tidb-admin|local-static-provisioner|chaos-testing"
              receiver: "loki"

    # NOTE: loki receiver, from: https://github.com/opsgenie/kubernetes-event-exporter/issues/99#issuecomment-823522010
    receivers:
      - name: "loki"
        webhook:
          endpoint: "http://test-infra-loki.test-infra-loki:3100/loki/api/v1/push"
          headers:
            Content-Type: application/json
            User-Agent: kube-event-exporter 0.9
          layout:
            streams:
              - stream:
                  severity: "{{ .Type }}"
                  reason: "{{ .Reason }}"
                  testbed: "{{ .InvolvedObject.Namespace }}"
                  kind: "{{ .InvolvedObject.Kind }}"
                  node: "{{ .Source.Host }}"
                  component: "{{ .Source.Component }}"
                values:
                - - "{{ .GetTimestampMs }}000000"
                  - "{{ .Message }}"
