Add support for CustomSchedule option in DatadogMonitor
What does this PR do?
Support the customSchedule option (rrule, timezone and start) in DatadogMonitor CRD.
Motivation
To implement the feature request
Additional Notes
N/A
Minimum Agent Versions
N/A
Describe your test plan
I've tested it locally with this manifests.
apiVersion: datadoghq.com/v1alpha1
kind: DatadogMonitor
metadata:
name: datadog-monitor-test
namespace: system
spec:
query: "avg(last_5m):avg:system.load.1{*} > 4"
type: "query alert"
name: "Test monitor made from DatadogMonitor"
message: "1-2-3 testing"
priority: 2
options:
includeTags: false
thresholds:
critical: "4"
schedulingOptions:
customeSchedule:
recurrence:
rrule: "FREQ=MONTHLY;BYMONTHDAY=2"
timezone: "America/New_York"
apiVersion: datadoghq.com/v1alpha1
kind: DatadogMonitor
metadata:
name: datadog-monitor-test
namespace: system
spec:
query: "avg(last_5m):avg:system.load.1{*} > 4"
type: "query alert"
name: "Test monitor made from DatadogMonitor"
message: "1-2-3 testing"
priority: 2
options:
includeTags: false
thresholds:
critical: "4"
schedulingOptions:
customeSchedule:
recurrence:
rrule: "FREQ=MONTHLY;BYMONTHDAY=2"
timezone: "America/New_York"
start: "2025-06-02T00:00:00"
apiVersion: datadoghq.com/v1alpha1
kind: DatadogMonitor
metadata:
name: datadog-monitor-test
namespace: system
spec:
query: "avg(last_5m):avg:system.load.1{*} > 4"
type: "query alert"
name: "Test monitor made from DatadogMonitor"
message: "1-2-3 testing"
priority: 2
options:
includeTags: false
thresholds:
critical: "4"
schedulingOptions:
customeSchedule:
recurrence:
rrule: "INVALID VALUE"
timezone: "America/New_York"
Checklist
- [ ] PR has at least one valid label:
bug,enhancement,refactoring,documentation,tooling, and/ordependencies - [ ] PR has a milestone or the
qa/skip-qalabel
@rafanaskin thanks for your contribution! I set 1.17 milestone, we will review and provide feedback in next few weeks.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 46.51%. Comparing base (
b1a1884) to head (ba6e6a9).
Additional details and impacted files
@@ Coverage Diff @@
## main #1949 +/- ##
==========================================
+ Coverage 46.47% 46.51% +0.03%
==========================================
Files 248 248
Lines 24687 24704 +17
==========================================
+ Hits 11473 11490 +17
Misses 12629 12629
Partials 585 585
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 46.51% <100.00%> (+0.03%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| internal/controller/datadogmonitor/monitor.go | 73.24% <100.00%> (+2.15%) |
:arrow_up: |
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update b1a1884...ba6e6a9. Read the comment docs.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Thank you @tbavelier, and I apologise for the typos.