[CONTP-1758] Improve DatadogGenericResource reconciliation at scale#3143
Conversation
🛑 Gate Violations
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3143 +/- ##
==========================================
+ Coverage 43.79% 44.73% +0.93%
==========================================
Files 375 377 +2
Lines 30575 31508 +933
==========================================
+ Hits 13390 14094 +704
- Misses 16276 16489 +213
- Partials 909 925 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 13 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
d08e2b9 to
b6051a5
Compare
b6051a5 to
29c92c9
Compare
d4a9c5c to
136adf5
Compare
drichards-87
left a comment
There was a problem hiding this comment.
Left some suggestions from Docs and approved the PR.
Co-authored-by: DeForest Richards <[email protected]>
Co-authored-by: DeForest Richards <[email protected]>
Co-authored-by: DeForest Richards <[email protected]>
Co-authored-by: DeForest Richards <[email protected]>
Co-authored-by: DeForest Richards <[email protected]>
Co-authored-by: DeForest Richards <[email protected]>
What does this PR do?
Improves
DatadogGenericResourcereconciliation behavior at high resource counts:DatadogGenericResourcecontroller concurrency with--datadogGenericResourceMaxConcurrentReconciles/DD_GENERIC_RESOURCE_MAX_CONCURRENT_RECONCILES--datadogGenericResourceRequeuePeriod/DD_GENERIC_RESOURCE_REQUEUE_PERIODDD_GENERIC_RESOURCE_REQUEUE_PERIODuses the shared duration env parser, so values must be valid Go duration strings such as30s,5m, or1h. Bare integers are invalid and leave the default60sin effect.Motivation
At high CR counts, periodic status polling can dominate the controller queue and delay user-facing create/update/delete operations. This keeps DDGR status polling tunable and lower priority while leaving normal reconciliation and backend error retries at regular priority.
Should help in situations like #2816
Additional Notes
The low-priority path is limited to DDGR
refreshStatereconciles, which currently applies to resource types that fetch backend state such as monitors and SLOs. It intentionally does not lower the priority of create/update/delete retries.Validated manually that
workqueue_depth{controller="DatadogGenericResource", priority="-100"}exposes low-priority queue depth for status polling requeues. Created 1k DDGR with 10 concurrent reconciles, then changed to 1 concurrent reconcile to accumulate backlog in low-priority queue for status updates. Created an additional DDGR and verified it was treated in priority over the backlog and synced with the backend.Shows the low-priority queue backlog while the regular priority is staying healthy.
Minimum Agent Versions
No minimum Agent or Cluster Agent version changes.
Describe your test plan
Automated tests:
Manual scale and priority check:
--datadogGenericResourceMaxConcurrentReconciles=10orDD_GENERIC_RESOURCE_MAX_CONCURRENT_RECONCILES=10.datadogGenericResourceMaxConcurrentReconcilesback to 1, or remove it since 1 is the default, and wait for the new operator pod to acquire the lease.kubectl apply -f examples/datadoggenericresource/dashboard-sample.yaml.kubectl delete ddgr ddgr-dashboard-sampleand confirm it is deleted.--datadogGenericResourceMaxConcurrentReconciles=10orDD_GENERIC_RESOURCE_MAX_CONCURRENT_RECONCILES=10and clean up the load-test resources.DDGR monitor load helper
Example:
Requeue period check:
DD_GENERIC_RESOURCE_REQUEUE_PERIOD=5m, or use--datadogGenericResourceRequeuePeriod=5m.DD_GENERIC_RESOURCE_REQUEUE_PERIODto an invalid duration such asfooor120.ignoring invalid env var DD_GENERIC_RESOURCE_REQUEUE_PERIOD=...message and resources fall back to the default 60s sync cadence.DD_GENERIC_RESOURCE_REQUEUE_PERIOD=5mand--datadogGenericResourceRequeuePeriod=2m, then verify the CLI flag wins.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel