apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: dns
  namespace: openshift-dns-operator
  labels:
    role: alert-rules
  annotations:
    include.release.openshift.io/ibm-cloud-managed: "true"
    include.release.openshift.io/self-managed-high-availability: "true"
    include.release.openshift.io/single-node-developer: "true"
spec:
  groups:
    - name: openshift-dns.rules
      rules:
      - alert: CoreDNSPanicking
        expr: increase(coredns_panics_total[10m]) > 0
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: CoreDNS panic
          description: "{{ $value }} CoreDNS panics observed on {{ $labels.instance }}"
      - alert: CoreDNSHealthCheckSlow
        expr: histogram_quantile(.95, sum(rate(coredns_health_request_duration_seconds_bucket[5m])) by (instance, le)) > 10
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: CoreDNS health checks
          description: "CoreDNS Health Checks are slowing down (instance {{ $labels.instance }})"
      - alert: CoreDNSErrorsHigh
        expr: |
          (sum(rate(coredns_dns_responses_total{rcode="SERVFAIL"}[5m]))
            /
          sum(rate(coredns_dns_responses_total[5m])))
          > 0.01
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: CoreDNS serverfail
          description: "CoreDNS is returning SERVFAIL for {{ $value | humanizePercentage }} of requests."
