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.
23 lines
709 B
Go
23 lines
709 B
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
ErrInvalidRuntimeConfig = errors.New("invalid runtime config provided to alerting/rules app")
|
|
)
|
|
|
|
// RuntimeConfig holds configuration values needed at runtime by the alerting/rules app from the running Grafana instance.
|
|
type RuntimeConfig struct {
|
|
// function to check folder existence given its uid
|
|
FolderValidator func(ctx context.Context, folderUID string) (bool, error)
|
|
// base evaluation interval
|
|
BaseEvaluationInterval time.Duration
|
|
// set of strings which are illegal for label keys on rules
|
|
ReservedLabelKeys map[string]struct{}
|
|
NotificationSettingsValidator func(ctx context.Context, receiver string) (bool, error)
|
|
}
|