...
1apiVersion: apiextensions.k8s.io/v1
2kind: CustomResourceDefinition
3metadata:
4 annotations:
5 api-approved.openshift.io: https://github.com/openshift/api/pull/1406
6 description: OpenShift Monitoring alerting rules
7 name: alertingrules.monitoring.openshift.io
8spec:
9 group: monitoring.openshift.io
10 names:
11 kind: AlertingRule
12 listKind: AlertingRuleList
13 plural: alertingrules
14 singular: alertingrule
15 scope: Namespaced
16 versions:
17 - name: v1
18 schema:
19 openAPIV3Schema:
20 description: "AlertingRule represents a set of user-defined Prometheus rule groups containing alerting rules. This resource is the supported method for cluster admins to create alerts based on metrics recorded by the platform monitoring stack in OpenShift, i.e. the Prometheus instance deployed to the openshift-monitoring namespace. You might use this to create custom alerting rules not shipped with OpenShift based on metrics from components such as the node_exporter, which provides machine-level metrics such as CPU usage, or kube-state-metrics, which provides metrics on Kubernetes usage. \n The API is mostly compatible with the upstream PrometheusRule type from the prometheus-operator. The primary difference being that recording rules are not allowed here -- only alerting rules. For each AlertingRule resource created, a corresponding PrometheusRule will be created in the openshift-monitoring namespace. OpenShift requires admins to use the AlertingRule resource rather than the upstream type in order to allow better OpenShift specific defaulting and validation, while not modifying the upstream APIs directly. \n You can find upstream API documentation for PrometheusRule resources here: \n https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md \n Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer)."
21 type: object
22 required:
23 - spec
24 properties:
25 apiVersion:
26 description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
27 type: string
28 kind:
29 description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30 type: string
31 metadata:
32 type: object
33 spec:
34 description: spec describes the desired state of this AlertingRule object.
35 type: object
36 required:
37 - groups
38 properties:
39 groups:
40 description: "groups is a list of grouped alerting rules. Rule groups are the unit at which Prometheus parallelizes rule processing. All rules in a single group share a configured evaluation interval. All rules in the group will be processed together on this interval, sequentially, and all rules will be processed. \n It's common to group related alerting rules into a single AlertingRule resources, and within that resource, closely related alerts, or simply alerts with the same interval, into individual groups. You are also free to create AlertingRule resources with only a single rule group, but be aware that this can have a performance impact on Prometheus if the group is extremely large or has very complex query expressions to evaluate. Spreading very complex rules across multiple groups to allow them to be processed in parallel is also a common use-case."
41 type: array
42 minItems: 1
43 items:
44 description: RuleGroup is a list of sequentially evaluated alerting rules.
45 type: object
46 required:
47 - name
48 - rules
49 properties:
50 interval:
51 description: 'interval is how often rules in the group are evaluated. If not specified, it defaults to the global.evaluation_interval configured in Prometheus, which itself defaults to 30 seconds. You can check if this value has been modified from the default on your cluster by inspecting the platform Prometheus configuration: The relevant field in that resource is: spec.evaluationInterval'
52 type: string
53 maxLength: 2048
54 pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
55 name:
56 description: name is the name of the group.
57 type: string
58 maxLength: 2048
59 minLength: 1
60 rules:
61 description: rules is a list of sequentially evaluated alerting rules. Prometheus may process rule groups in parallel, but rules within a single group are always processed sequentially, and all rules are processed.
62 type: array
63 minItems: 1
64 items:
65 description: 'Rule describes an alerting rule. See Prometheus documentation: - https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules'
66 type: object
67 required:
68 - alert
69 - expr
70 properties:
71 alert:
72 description: alert is the name of the alert. Must be a valid label value, i.e. may contain any Unicode character.
73 type: string
74 maxLength: 2048
75 minLength: 1
76 annotations:
77 description: annotations to add to each alert. These are values that can be used to store longer additional information that you won't query on, such as alert descriptions or runbook links.
78 type: object
79 additionalProperties:
80 type: string
81 expr:
82 description: 'expr is the PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending or firing alerts. This is most often a string representing a PromQL expression, e.g.: mapi_current_pending_csr > mapi_max_pending_csr In rare cases this could be a simple integer, e.g. a simple "1" if the intent is to create an alert that is always firing. This is sometimes used to create an always-firing "Watchdog" alert in order to ensure the alerting pipeline is functional.'
83 anyOf:
84 - type: integer
85 - type: string
86 x-kubernetes-int-or-string: true
87 for:
88 description: for is the time period after which alerts are considered firing after first returning results. Alerts which have not yet fired for long enough are considered pending.
89 type: string
90 maxLength: 2048
91 pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
92 labels:
93 description: 'labels to add or overwrite for each alert. The results of the PromQL expression for the alert will result in an existing set of labels for the alert, after evaluating the expression, for any label specified here with the same name as a label in that set, the label here wins and overwrites the previous value. These should typically be short identifying values that may be useful to query against. A common example is the alert severity, where one sets `severity: warning` under the `labels` key:'
94 type: object
95 additionalProperties:
96 type: string
97 x-kubernetes-list-map-keys:
98 - name
99 x-kubernetes-list-type: map
100 status:
101 description: status describes the current state of this AlertOverrides object.
102 type: object
103 properties:
104 observedGeneration:
105 description: observedGeneration is the last generation change you've dealt with.
106 type: integer
107 format: int64
108 prometheusRule:
109 description: prometheusRule is the generated PrometheusRule for this AlertingRule. Each AlertingRule instance results in a generated PrometheusRule object in the same namespace, which is always the openshift-monitoring namespace.
110 type: object
111 required:
112 - name
113 properties:
114 name:
115 description: name of the referenced PrometheusRule.
116 type: string
117 maxLength: 2048
118 minLength: 1
119 served: true
120 storage: true
121 subresources:
122 status: {}
123status:
124 acceptedNames:
125 kind: ""
126 plural: ""
127 conditions: []
128 storedVersions: []
View as plain text