Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11f0fd5c58
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if r.options.CreateControllerRevisions { | ||
| if err := r.manageRevision(ctx, instance, newDDAStatus); err != nil { | ||
| return r.updateStatusIfNeededV2(logger, instance, ddaStatusCopy, result, err, now) | ||
| } | ||
| } |
There was a problem hiding this comment.
Create revisions in both reconcile modes when flag is on
With createControllerRevisions=true, revisions are only managed inside reconcileInstanceV3, but internalReconcileV2 still routes to reconcileInstanceV2 whenever DatadogAgentInternalEnabled is false. In that supported configuration, the new flag silently does nothing, so no ControllerRevision snapshots are created even though the CLI flag explicitly says it applies to DDA spec changes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Changed in 86357ab by enforcing DatadogAgentInternalEnabled=true in order for createControllerRevisions to be true
| if err := r.client.List(ctx, revList, | ||
| client.InNamespace(instance.GetNamespace()), | ||
| client.MatchingLabels{apicommon.DatadogAgentNameLabelKey: instance.GetName()}, | ||
| ); err != nil { |
There was a problem hiding this comment.
Scope revision listing to the current DDA owner UID
Revision selection and GC are driven from listRevisions, which currently matches only namespace plus the DDA-name label. If a DDA is deleted/recreated with the same name (or another revision is mislabeled), this controller can reuse or delete ControllerRevisions not owned by the current object UID, causing currentRevision/previousRevision to reference foreign history and making rollback state unstable. Filtering by controller owner reference (UID/controller=true) is needed here.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (66.90%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2767 +/- ##
==========================================
- Coverage 38.80% 38.57% -0.23%
==========================================
Files 309 311 +2
Lines 26750 27448 +698
==========================================
+ Hits 10379 10589 +210
- Misses 15592 16069 +477
- Partials 779 790 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
What does this PR do?
Creates controller revisions for DDAs
Motivation
https://datadoghq.atlassian.net/browse/CONTP-1399
Additional Notes
Anything else we should know when reviewing?
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
Describe your test plan
createControllerRevisionsand set totruekubectl get controllerrevisions. It should also be reflected in DDA statusChecklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel