Skip to content

[Backport v1.27] FA rollout experiment fixes#3049

Merged
levan-m merged 1 commit into
v1.27from
backport-3035-to-v1.27
May 27, 2026
Merged

[Backport v1.27] FA rollout experiment fixes#3049
levan-m merged 1 commit into
v1.27from
backport-3035-to-v1.27

Conversation

@dd-octo-sts

@dd-octo-sts dd-octo-sts Bot commented May 27, 2026

Copy link
Copy Markdown

Backport c85321f from #3035.


What does this PR do?

Addressing several bugs/issues:

  • When changing same config back and forth to rollout, two controller revisions basically get version bump reusing same name/hash. This leads to accumulation of both marker annotations if one config update is rolled back.
        operator.datadoghq.com/experiment-promoted: "true"
        operator.datadoghq.com/experiment-rollback: "true"
  • Again when flipping same config, revisions of two controllerrevs increase while their creationTimestamp which is used as proxy for experiment start time, doesn't change. Once these revisions are old enough controller will timeout and rollback.
  • If experiment times out, subsequent experiments will fail unless different config change to force new controller rev creation.
  • Operator doesn't send task abort or timeout errors to FA (regardless how FA processes those, which now are ignored).

Easiest to review Commit by commit

b6ef9e5 Decouples experiment timing from ControllerRevision metadata by adding explicit StartedAt field to ExperimentStatus. rev.CreationTimestamp might 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 abort error 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?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Below args needs to be set on Operator (debug level logging recommended)

        - --createControllerRevisions=true
        - --remoteUpdatesEnabled=true
        - --remoteConfigEnabled=true

and env vars to configure cluster name and endpoint

        - name: DD_CLUSTER_NAME
          value: my-test-cluster
        - name: DD_SITE
          value: datad0g.com          # endpoint for internal testing and api/app key in the same org

Happy path

  1. Apply DDA
  2. Go to FA -> find cluster -> Configuration -> Edit -> Deploy
  3. Switch to Deployments view in FA see it succeeds.
  4. Check the change was applied in cluster.

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_out and 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

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label
  • All commits are signed (see: signing commits)

* 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)
@dd-octo-sts
dd-octo-sts Bot requested review from a team as code owners May 27, 2026 14:22
@dd-octo-sts dd-octo-sts Bot added bug Something isn't working enhancement New feature or request backport label added by backport action bot label added by backport bot team/container-platform team/container-autoscaling team/fleet labels May 27, 2026
@dd-octo-sts dd-octo-sts Bot added this to the v1.27.0 milestone May 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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-commenter

codecov-commenter commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.01235% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.44%. Comparing base (6714de3) to head (385221a).

Files with missing lines Patch % Lines
pkg/fleet/daemon.go 65.38% 6 Missing and 3 partials ⚠️
internal/controller/datadogagent/experiment.go 76.92% 4 Missing and 2 partials ⚠️
pkg/fleet/daemon_worker.go 92.85% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 41.44% <79.01%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/controller/datadogagent/revision.go 78.46% <100.00%> (ø)
pkg/fleet/daemon_worker.go 78.18% <92.85%> (+1.95%) ⬆️
internal/controller/datadogagent/experiment.go 77.52% <76.92%> (-0.08%) ⬇️
pkg/fleet/daemon.go 69.34% <65.38%> (-0.60%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6714de3...385221a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-datadog-prod-us1-2

Copy link
Copy Markdown

Code Coverage

Fix all issues with BitsAI

🛑 Gate Violations

🎯 1 Code Coverage issue detected

A Patch coverage percentage gate may be blocking this PR.

Patch coverage: 76.71% (threshold: 80.00%)

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 76.71%
Overall Coverage: 41.76% (+0.06%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 385221a | Docs | Datadog PR Page | Give us feedback!

@levan-m
levan-m merged commit 68f6e13 into v1.27 May 27, 2026
72 of 74 checks passed
@levan-m
levan-m deleted the backport-3035-to-v1.27 branch May 27, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport label added by backport action bot label added by backport bot bug Something isn't working enhancement New feature or request team/container-autoscaling team/container-platform team/fleet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants