- 
                Notifications
    You must be signed in to change notification settings 
- Fork 440
Description
Describe the bug
When exporting Alerts and AlertGroups from Grafana in order to populate a GrafanaAlertRuleGroup CR, we see that when specific values are picked for pending period( .spec.rules[*].for) like 24h, Grafana will export it as 1d.
At the time of writing, years, weeks, and days are not supported in the .spec.rules[*].for field.
Version
v5.19.4
To Reproduce
Steps to reproduce the behavior:
- Open a Grafana v11.5.3or later
- Create or modify an alert rule
- Set the pending period to 24h
- Save and Export the alert, notice it should have converted the pending period to 1d
- Apply the rule as a CRD
- 
# grafanaalertrulegroups.grafana.integreatly.org "grafana-health" was not valid: # * spec.rules[0].for: Invalid value: "1d": spec.rules[0].for in body should match '^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$'
Expected behavior
Following the above steps, the CRD should be succesfully applied and synchronized with matching instances.
Suspect component/Location where the bug might be occurring
| // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$" | 
Runtime (please complete the following information):
- OS: Linux
- Grafana Operator Version: v5.19.4
- Environment: Kubernetes 1.31
- Deployment type: Helm
- Other: N/A
Additional context
It might be worth it to remove ns, us, µs, ms as they do not make much sense as alert delays and add d and w. and omit y as that does not make much sense either.