apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    prometheus: k8s
    role: alert-rules
  name: machineapprover-rules
  namespace: openshift-cluster-machine-approver
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
    include.release.openshift.io/self-managed-high-availability: "true"
    include.release.openshift.io/single-node-developer: "true"
spec:
  groups:
    - name: cluster-machine-approver.rules
      rules:
        - alert: ClusterMachineApproverDown
          annotations:
            message: ClusterMachineApprover has disappeared from Prometheus target
              discovery.
          expr: |
            absent(up{job="machine-approver"} == 1)
          for: 10m
          labels:
            severity: critical
        - alert: MachineApproverMaxPendingCSRsReached
          expr: |
             mapi_current_pending_csr > mapi_max_pending_csr
          for: 5m
          labels:
            severity: warning
          annotations:
            message: "max pending CSRs threshold reached."
