Add an experimental prepared blue-green Agent rollout - #3355
Draft
AliDatadog wants to merge 13 commits into
Draft
Conversation
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The current node-Agent DaemonSet stops a working Pod before Kubernetes schedules, pulls and starts its replacement. A slow or failed replacement can therefore leave the node uncovered. Native DaemonSet surge does not solve the full problem: the prepared Agent must sleep to avoid host-resource conflicts, so ordinary readiness cannot both mean “prepared” and “healthy.”
This PoC separates preparation from serving while keeping unavailability bounded like a RollingUpdate.
What does this PR do?
Adds an annotation-gated, experimental prepared blue/green rollout for Linux node Agents:
The Operator maintains two
OnDeleteDaemonSets and three durable per-node states:Before source removal, every target container must be Running without a restart, and the Operator must observe the same target Pod UID in two reconciliations. After source removal, the target consumes the configured
maxUnavailablebudget until its exact revision is Ready for the DaemonSet'sminReadySeconds. The current generated DaemonSets leaveminReadySecondsat Kubernetes' zero-second default; the experimental deployment will configuremaxUnavailable: 5%.If a sleeping candidate restarts while the source remains Available, the Operator deletes only that target Pod so its
OnDeleteDaemonSet retries it. A recovered exact-revision target can complete handoff when the source is already unavailable.The transformation preserves the configured network mode. With
hostNetwork: true, it removes declared container ports so Kubernetes does not reserve duplicate host ports; the active process still binds the original node ports. Green core Agents use command port5002to isolate known mixed-generation local control traffic. A hostPath lock serializes each same-named component's UDS and listener ownership.Important trade-offs
Minimum Agent versions
agent-rollout-gateCompanion Agent PoC: DataDog/datadog-agent#54832
Test plan
Passed locally on the final merged tree:
go test -p 1 ./internal/controller ./internal/controller/datadogagentinternal ./internal/controller/datadogagent -count=1make lint— 0 issuesmake verify-licensesNo experimental-cluster rollout has been performed yet. After review, validate conventional-to-prepared migration, fresh install, prepared-to-prepared update, new-node behavior, insufficient-capacity fallback, failed pulls/startup and opt-out.
Checklist
enhancementqa/skip-qalabel