Files
grafana/apps/alerting/rules/definitions/alertrule.rules.alerting.grafana.app.yaml
T
Moustafa Baiou 0a85a30642 Alerting: Define rules.alerting.grafana.app/v0alpha1 AlertRule and RecordingRule
The first version of the app platform apis for alerting rules, including AlertRule and RecordingRule definitions.

Co-authored-by: William Wernert <william.wernert@grafana.com>
2025-09-10 09:30:56 -04:00

210 lines
11 KiB
YAML

kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1
metadata:
name: alertrules.rules.alerting.grafana.app
spec:
group: rules.alerting.grafana.app
versions:
- name: v0alpha1
served: true
storage: true
schema:
openAPIV3Schema:
properties:
spec:
properties:
annotations:
additionalProperties:
type: string
type: object
data:
additionalProperties:
properties:
datasourceUID:
pattern: ^[a-zA-Z0-9_-]+$
type: string
model: {}
queryType:
type: string
relativeTimeRange:
properties:
from:
pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$
type: string
to:
pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$
type: string
required:
- from
- to
type: object
source:
type: boolean
required:
- queryType
- datasourceUID
- model
type: object
type: object
execErrState:
default: Error
enum:
- Error
- Ok
- Alerting
- KeepLast
type: string
for:
allOf:
- pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?|0)$
- not:
pattern: hmuµn
type: string
keepFiringFor:
allOf:
- pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?|0)$
- not:
pattern: hmuµn
type: string
labels:
additionalProperties:
type: string
type: object
missingSeriesEvalsToResolve:
minimum: 0
type: integer
noDataState:
default: NoData
enum:
- NoData
- Ok
- Alerting
- KeepLast
type: string
notificationSettings:
properties:
activeTimeIntervals:
items:
type: string
type: array
groupBy:
items:
type: string
type: array
groupInterval:
allOf:
- pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?|0)$
- not:
pattern: hmuµn
type: string
groupWait:
allOf:
- pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?|0)$
- not:
pattern: hmuµn
type: string
muteTimeIntervals:
items:
type: string
type: array
receiver:
type: string
repeatInterval:
allOf:
- pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?|0)$
- not:
pattern: hmuµn
type: string
required:
- receiver
type: object
panelRef:
properties:
dashboardUID:
minLength: 1
pattern: ^[a-zA-Z0-9_-]+$
type: string
panelID:
exclusiveMinimum: true
minimum: 0
type: integer
required:
- dashboardUID
- panelID
type: object
paused:
type: boolean
title:
type: string
trigger:
properties:
interval:
allOf:
- pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?|0)$
- not:
pattern: hmuµn
type: string
required:
- interval
type: object
required:
- title
- data
- trigger
- noDataState
- execErrState
type: object
x-kubernetes-preserve-unknown-fields: true
status:
properties:
additionalFields:
description: additionalFields is reserved for future use
type: object
x-kubernetes-preserve-unknown-fields: true
operatorStates:
additionalProperties:
properties:
descriptiveState:
description: descriptiveState is an optional more descriptive state field which has no requirements on format
type: string
details:
description: details contains any extra information that is operator-specific
type: object
x-kubernetes-preserve-unknown-fields: true
lastEvaluation:
description: lastEvaluation is the ResourceVersion last evaluated
type: string
state:
description: |-
state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
enum:
- success
- in_progress
- failed
type: string
required:
- lastEvaluation
- state
type: object
description: |-
operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
type: object
type: object
required:
- spec
type: object
subresources:
status: {}
selectableFields:
- jsonPath: .spec.title
- jsonPath: .spec.paused
- jsonPath: .spec.panelRef.dashboardUID
- jsonPath: .spec.panelRef.panelID
- jsonPath: .spec.notificationSettings.receiver
names:
kind: AlertRule
plural: alertrules
scope: Namespaced