Alerting: Add support for alpha rules apis in legacy storage

Rules created in the new api makes the rule have no group in the database, but the rule is returned in the old group api with a sentinel group name formatted with the rule uid for compatiblity with the old api.
This makes the UI continue to work with the rules without a group, and the ruler will continue to work with the rules without a group.

Rules are not allowed to be created in the provisioning api with a NoGroup sentinel mask, but NoGroup rules can be manipulated through both the new and old apis.

Co-authored-by: William Wernert <william.wernert@grafana.com>
This commit is contained in:
Moustafa Baiou
2025-07-31 18:56:50 -04:00
committed by Moustafa Baiou
parent 0a85a30642
commit ca8324e62a
50 changed files with 8729 additions and 110 deletions
+4
View File
@@ -30,6 +30,7 @@ func TestIntegrationOpenAPIs(t *testing.T) {
featuremgmt.FlagProvisioning,
featuremgmt.FlagInvestigationsBackend,
featuremgmt.FlagGrafanaAdvisor,
featuremgmt.FlagKubernetesAlertingRules,
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // all datasources
},
})
@@ -94,6 +95,9 @@ func TestIntegrationOpenAPIs(t *testing.T) {
}, {
Group: "notifications.alerting.grafana.app",
Version: "v0alpha1",
}, {
Group: "rules.alerting.grafana.app",
Version: "v0alpha1",
}}
for _, gv := range groups {
VerifyOpenAPISnapshots(t, dir, gv, h)