1e1adafeec
This adds validating admission hooks to enforce the requirements on AlertRules and RecordingRules that are currently enforced through the provisioning service and storage mechanisms in preparation of a consistent validation in both legacy storage and unified storage. It also adds a mutating admission hook to the app to ensure that folder annotations and folder labels are kept in sync so we can perform label-selector lists.
37 lines
647 B
CUE
37 lines
647 B
CUE
package kinds
|
|
|
|
import (
|
|
"github.com/grafana/grafana/apps/alerting/rules/kinds/v0alpha1"
|
|
)
|
|
|
|
recordingRuleKind: {
|
|
kind: "RecordingRule"
|
|
pluralName: "RecordingRules"
|
|
}
|
|
|
|
recordingRulev0alpha1: recordingRuleKind & {
|
|
schema: {
|
|
spec: v0alpha1.RecordingRuleSpec
|
|
}
|
|
validation: {
|
|
operations: [
|
|
"CREATE",
|
|
"UPDATE",
|
|
]
|
|
}
|
|
mutation: {
|
|
operations: [
|
|
"CREATE",
|
|
"UPDATE",
|
|
]
|
|
}
|
|
selectableFields: [
|
|
"spec.title",
|
|
"spec.paused",
|
|
// FIXME(@moustafab): not sure why these fields are being considered structs... Bug in codegen
|
|
// "spec.metric",
|
|
// "spec.targetDatasourceUID",
|
|
// TODO: add status fields for filtering
|
|
]
|
|
}
|