Alerting: Annotation CanUse for receiver resource (#110839)

* add origin to receiver
* populate origin of the receiver
* set CanUse to false if origin is not Grafana
* set provenance if origin is imported
* set Grafana origin by default in conversion API
* set canUse annotation
* reject update\delete operations on resources with origin other than Grafana
* fail to create with wrong origin
This commit is contained in:
Yuri Tseretyan
2025-09-16 09:32:04 -04:00
committed by GitHub
parent a15b6ec2a2
commit 356521c9b9
11 changed files with 78 additions and 21 deletions
@@ -608,6 +608,7 @@ func TestIntegrationAccessControl(t *testing.T) {
// Set expected metadata.
expectedWithMetadata := expected.Copy().(*v0alpha1.Receiver)
expectedWithMetadata.SetInUse(0, nil)
expectedWithMetadata.SetCanUse(true)
if tc.canUpdate {
expectedWithMetadata.SetAccessControl("canWrite")
}
@@ -1294,6 +1295,7 @@ func TestIntegrationCRUD(t *testing.T) {
receiver.SetAccessControl("canReadSecrets")
receiver.SetAccessControl("canAdmin")
receiver.SetInUse(0, nil)
receiver.SetCanUse(true)
// Use export endpoint because it's the only way to get decrypted secrets fast.
cliCfg := helper.Org1.Admin.NewRestConfig()