[Backport v1.27] FA rollout experiment fixes#3049
Conversation
* fix(experiment): anchor timeout on Status.Experiment.StartedAt * fix(fleet): rehydrate installer state from DatadogAgent on daemon startup * fix(experiment): report TaskState_ERROR for the original start task on timeout * refactor(experiment): single experiment-state annotation on revisions * fix(fleet): publish abort to Fleet Automation the same way as timeout (cherry picked from commit c85321f)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 385221a8d2
ℹ️ 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 rev != nil { | ||
| elapsed := now.Sub(rev.CreationTimestamp.Time) | ||
| if rev != nil && instance.Status.Experiment.StartedAt != nil { |
There was a problem hiding this comment.
Preserve timeout fallback for missing StartedAt
For experiments that were already Running before upgrading to this version, status.experiment.startedAt is absent because the field is new and optional. This guard now skips the timeout calculation entirely in that case, so those in-flight experiments never auto-terminate on timeout (and the daemon never observes the terminal timeout path) unless a manual stop/promote arrives. Please retain a fallback timeout anchor for nil StartedAt or backfill it for existing Running statuses.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v1.27 #3049 +/- ##
==========================================
+ Coverage 41.37% 41.44% +0.06%
==========================================
Files 334 334
Lines 28581 28637 +56
==========================================
+ Hits 11826 11869 +43
- Misses 15965 15973 +8
- Partials 790 795 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🛑 Gate Violations
ℹ️ Info🎯 Code Coverage (details) Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 385221a | Docs | Datadog PR Page | Give us feedback! |
Backport c85321f from #3035.
What does this PR do?
Addressing several bugs/issues:
creationTimestampwhich is used as proxy for experiment start time, doesn't change. Once these revisions are old enough controller will timeout and rollback.Easiest to review Commit by commit
b6ef9e5 Decouples experiment timing from
ControllerRevisionmetadata by adding explicitStartedAtfield toExperimentStatus.rev.CreationTimestampmight be stale if new spec has is same as earlier experiment. This could lead to immediate timeout if spec matched pre-existing controller rev spec.d202cf7 rehydrate installer state from DatadogAgent on daemon startup to report state with correct task ID instead of empty one forcing FA to send start requests.
6cf24ad report TaskState_ERROR for the original start task on timeout.
8509c37 replaces two annotations (
*experiment-promoted,*experiment-rollback) on controller rev with a single annotation to avoid accidentally accumulating two mutually exclusive annotations and to simplify logic. Bug reproducible by flipping same config back and forth and intentionally failing experiment to force rollback.5aa1b51 similar to 6cf24ad, report
aborterror for the experiment task when DDA is changed during experiment.Motivation
What inspired you to submit this pull request?
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
Below args needs to be set on Operator (debug level logging recommended)
and env vars to configure cluster name and endpoint
Happy path
Failures
timeout
2. Watch dda yaml
| yq .status.experiment, once experiment is running scale Operator to 0 replicas.3. Wait 15min
4. Scale back to 1
5. Operator marks experiment as
timed_outand is rolled back. FA retries same experiment eventually failing deployment.6. try happy path
abort
2. Watch dda yaml
| yq .status.experiment, once experiment is running scale Operator to 0 replicas.3. Apply updated DDA in cluster
4. Operator marks experiment as
aborted, updated DDA should be reconciled in cluster. FA retries same experiment eventually failing deployment.5. Try happy path.
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel