Fix: NotificationPolicy LoopDetected condition and route.receiver
validation
#1843
+69
−47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on #1837 on I was unable to provoke the
LoopDetected
status and discovered that it was removed immediately after being set, the detection itself seems to work without issues.The above resulted in loops being detected, dynamic routes being ignored and an
ApplySucceeded
condition onGrafanaNotificationPolicy
CRsThis means that previously working NotificationPolicy trees with dynamic routes would be overwritten with only the static routes in the main
GrafanaNotificationPolicy
, if any.This changes the behaviour from applying only static routes and ignoring everything dynamic to refusing updates entirely.
LoopDetected
is now before fetching instances resulting in it having higher priority.InvalidSpec
is an error and theNoMatchingInstances
is not.receiver
is now a required field due to the current implementation always returning400 BAD REQUEST
when trying to apply a route when the receiver is omitted.Lastly, the
grafana-operator
category was missing from theGrafanaNotificationPolicyRoute