apiVersion: v1
data:
  rules.yml: |
    groups:
    - name: pod-alert-rule
      rules:
      - alert: Deployment_Not_Running
        expr: (max(kube_deployment_status_replicas_available{namespace!~"vortex|kube-system" }) by (deployment,namespace) == 0) * on(deployment,namespace) group_left(label_email_account,label_email_domain)(kube_deployment_labels)
        for: 2m
        labels:
          admin: false
          email_account: "{{ "{{" }}$labels.label_email_account{{ "}}" }}"
          email_domain: "{{ "{{" }}$labels.label_email_domain{{ "}}" }}"
        annotations:
          description: "There is no avaiable pod for the deployment \"{{ "{{" }}$labels.deployment{{ "}}" }}\" in namespace \"{{ "{{" }}$labels.namespace{{ "}}" }}\"."
      - alert: Vortex_Not_Running
        expr: (max(kube_deployment_status_replicas_available{namespace=~"vortex|kube-system" }) by (deployment,namespace) == 0)
        for: 2m
        labels:
          admin: true
          email_account: admin
        annotations:
          description: "There is no avaiable pod for the deployment \"{{ "{{" }}$labels.deployment{{ "}}" }}\" in namespace \"{{ "{{" }}$labels.namespace{{ "}}" }}\"."
kind: ConfigMap
metadata:
  name: prometheus-rules
  namespace: vortex


