-
Notifications
You must be signed in to change notification settings - Fork 11.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alerting: support the Grafana operator as export format provider #87954
base: main
Are you sure you want to change the base?
Conversation
@@ -271,7 +271,7 @@ type AlertRuleExport struct { | |||
ForString *string `json:"-" yaml:"-" hcl:"for"` | |||
Annotations *map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty" hcl:"annotations"` | |||
Labels *map[string]string `json:"labels,omitempty" yaml:"labels,omitempty" hcl:"labels"` | |||
IsPaused bool `json:"isPaused" yaml:"isPaused" hcl:"is_paused"` | |||
IsPaused bool `json:"isPaused,omitempty" yaml:"isPaused,omitempty" hcl:"is_paused"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenAPI Spec has this as not required (= the generated go client has it as omitempty
) so I'm reflecting the change here
@@ -287,7 +287,7 @@ type AlertQueryExport struct { | |||
|
|||
type RelativeTimeRangeExport struct { | |||
FromSeconds int64 `json:"from" yaml:"from" hcl:"from"` | |||
ToSeconds int64 `json:"to" yaml:"to" hcl:"to"` | |||
ToSeconds int64 `json:"to,omitempty" yaml:"to,omitempty" hcl:"to"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenAPI Spec has this as not required (= the generated go client has it as omitempty
) so I'm reflecting the change here
...r.spec, | ||
rules: r.spec.rules.map(({ notification_settings, ...rule }: any) => ({ | ||
...rule, | ||
for: rule.for.endsWith('m') ? rule.for + '0s' : rule.for, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prevents the change noticed in grafana/grafana-operator#1492
What is this feature?
This PR adds a new export provider for the grafana-operator to the alerting export drawer.
Why do we need this feature?
Configuring alerting rules as-code is very complex. To alleviate this, many users utilize the
Modify Export
functionality. The YAML export is mostly compatible but requires further modification to be imported as an operator resource. Due to differences in serialization, it also causes CD solutions to trigger changes when there are none.Who is this feature for?
Users wishing to export their alerting resources as code and use them with the Operator
Which issue(s) does this PR fix?:
Implements grafana/grafana-operator#1492
Special notes for your reviewer:
Since the operator does not (yet) support Notification Policies & Mute Timings, I've added a way to filter for supported export providers.
Please check that: