@@ -29,7 +29,7 @@ type GrafanaNotificationPolicySpec struct {
2929 GrafanaCommonSpec `json:",inline"`
3030
3131 // Routes for alerts to match against
32- Route * PartialRoute `json:"route"`
32+ Route * RootRoute `json:"route"`
3333
3434 // Whether to enable or disable editing of the notification policy in Grafana UI
3535 // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
@@ -67,6 +67,34 @@ type PartialRoute struct {
6767 Provenance models.Provenance `json:"provenance,omitempty"`
6868}
6969
70+ // +kubebuilder:validation:XValidation:rule="!has(self.continue)", message="continue is invalid on the top level route node"
71+ // +kubebuilder:validation:XValidation:rule="!has(self.match_re)", message="match_re is invalid on the top level route node"
72+ // +kubebuilder:validation:XValidation:rule="!has(self.matchers)", message="matchers is invalid on the top level route node"
73+ // +kubebuilder:validation:XValidation:rule="!has(self.object_matchers)", message="object_matchers is invalid on the top level route node"
74+ // +kubebuilder:validation:XValidation:rule="!has(self.mute_time_intervals)", message="mute_time_intervals is invalid on the top level route node"
75+ // +kubebuilder:validation:XValidation:rule="!has(self.active_time_intervals)", message="active_time_intervals is invalid on the top level route node"
76+ type RootRoute struct {
77+ PartialRoute `json:",inline"`
78+
79+ // Deprecated: Never worked on the top level route node
80+ Continue bool `json:"continue,omitempty"`
81+
82+ // Deprecated: Never worked on the top level route node
83+ MatchRe models.MatchRegexps `json:"match_re,omitempty"`
84+
85+ // Deprecated: Never worked on the top level route node
86+ Matchers Matchers `json:"matchers,omitempty"`
87+
88+ // Deprecated: Never worked on the top level route node
89+ ObjectMatchers models.ObjectMatchers `json:"object_matchers,omitempty"`
90+
91+ // Deprecated: Never worked on the top level route node
92+ MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"`
93+
94+ // Deprecated: Never worked on the top level route node
95+ ActiveTimeIntervals []string `json:"active_time_intervals,omitempty"`
96+ }
97+
7098type Route struct {
7199 PartialRoute `json:",inline"`
72100
@@ -140,7 +168,7 @@ func (r *Route) ToModelRoute() *models.Route {
140168 return out
141169}
142170
143- func (r * PartialRoute ) ToModelRoute () * models.Route {
171+ func (r * RootRoute ) ToModelRoute () * models.Route {
144172 out := & models.Route {
145173 GroupBy : r .GroupBy ,
146174 GroupInterval : r .GroupInterval ,
0 commit comments