{
  "description": "The `PrometheusRule` custom resource definition (CRD) defines [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) and [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) rules to be evaluated by `Prometheus` or `ThanosRuler` objects.\n\n`Prometheus` and `ThanosRuler` objects select `PrometheusRule` objects using label and namespace selectors.",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": [
        "string",
        "null"
      ]
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ]
    },
    "spec": {
      "additionalProperties": false,
      "description": "Specification of desired alerting rule definitions for Prometheus.",
      "properties": {
        "groups": {
          "description": "Content of Prometheus rule file",
          "items": {
            "additionalProperties": false,
            "description": "RuleGroup is a list of sequentially evaluated recording and alerting rules.",
            "properties": {
              "interval": {
                "description": "Interval determines how often rules in the group are evaluated.",
                "pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
                "type": [
                  "string",
                  "null"
                ]
              },
              "labels": {
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Labels to add or overwrite before storing the result for its rules.\nThe labels defined at the rule level take precedence.\n\nIt requires Prometheus \u003e= 3.0.0.\nThe field is ignored for Thanos Ruler.",
                "type": [
                  "object",
                  "null"
                ]
              },
              "limit": {
                "description": "Limit the number of alerts an alerting rule and series a recording\nrule can produce.\nLimit is supported starting with Prometheus \u003e= 2.31 and Thanos Ruler \u003e= 0.24.",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "description": "Name of the rule group.",
                "minLength": 1,
                "type": "string"
              },
              "partial_response_strategy": {
                "description": "PartialResponseStrategy is only used by ThanosRuler and will\nbe ignored by Prometheus instances.\nMore info: https://github.com/thanos-io/thanos/blob/main/docs/components/rule.md#partial-response",
                "pattern": "^(?i)(abort|warn)?$",
                "type": [
                  "string",
                  "null"
                ]
              },
              "query_offset": {
                "description": "Defines the offset the rule evaluation timestamp of this particular group by the specified duration into the past.\n\nIt requires Prometheus \u003e= v2.53.0.\nIt is not supported for ThanosRuler.",
                "pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
                "type": [
                  "string",
                  "null"
                ]
              },
              "rules": {
                "description": "List of alerting and recording rules.",
                "items": {
                  "additionalProperties": false,
                  "description": "Rule describes an alerting or recording rule\nSee Prometheus documentation: [alerting](https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) or [recording](https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules) rule",
                  "properties": {
                    "alert": {
                      "description": "Name of the alert. Must be a valid label value.\nOnly one of `record` and `alert` must be set.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "annotations": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Annotations to add to each alert.\nOnly valid for alerting rules.",
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "expr": {
                      "description": "PromQL expression to evaluate.",
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ],
                      "x-kubernetes-int-or-string": true
                    },
                    "for": {
                      "description": "Alerts are considered firing once they have been returned for this long.",
                      "pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "keep_firing_for": {
                      "description": "KeepFiringFor defines how long an alert will continue firing after the condition that triggered it has cleared.",
                      "minLength": 1,
                      "pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "labels": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Labels to add or overwrite.",
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "record": {
                      "description": "Name of the time series to output to. Must be a valid metric name.\nOnly one of `record` and `alert` must be set.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "expr"
                  ],
                  "type": "object"
                },
                "type": [
                  "array",
                  "null"
                ]
              }
            },
            "required": [
              "name"
            ],
            "type": "object"
          },
          "type": [
            "array",
            "null"
          ],
          "x-kubernetes-list-map-keys": [
            "name"
          ],
          "x-kubernetes-list-type": "map"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}