[CASCL-338] feat(autoscaling): add pause and force-fallback ops annotations to DPA #56984
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 433 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #56984"
general
weight: 0.35
clamoriniere
What does this PR do?
Adds two annotations on
DatadogPodAutoscalerthat let an operator change behaviour without editing the spec:autoscaling.datadoghq.com/pause: "true"— the autoscaler applies nothing: no horizontal scaling, no vertical rollout or in-place resize, no admission-webhook pod patching. Manual edits to the target workload (replicas, container resources) are left alone. Pause is enforced where actions are applied, through a singleCanApply()gate shared by the horizontal and vertical paths, and reported asActive=Falsewith reasonLocallyPaused.autoscaling.datadoghq.com/force-fallback: "true"— handled like backend recommendations going stale, so the local fallback takes over even when backend values are fresh. It never overrides the spec: the local recommender still only runs whenspec.fallback.horizontal.enabledallows it.Gating the admission webhook matters as much as the controller here:
ApplyRecommendationsdeliberately rewrites container resources to undo manual pod edits, so without it a user's Deployment change would silently not stick on replacement pods.Both annotations work whatever the owner (local, remote, profile-managed), so an operator can act in-cluster during an incident even on a remotely managed DPA. A value that isn't a valid boolean is ignored, as if the annotation were absent.
On the telemetry side there's a new
…autoscaling.workload.pausedgauge, and…local.fallback_enablednow carries afallback_triggertag (stalevsforced). Worth a look during review: that tag changes an existing metric's series, and without it the metric becomes ambiguous the moment force-fallback ships, since the fallback can now be switched on by an operator rather than only by stale recommendations.metrics/metrics.mdis updated for both.Motivation
During an incident there's no way to stop a DPA short of editing the spec —
applyPolicy.mode: Preview, disabling both scale directions, or deleting the object. All of those mutate desired state, so they fight GitOps and the profile syncer, and they're easy to forget to revert.Separately, the local fallback only engages once backend values go stale. Recommendations that are fresh but wrong currently have no escape hatch.
Describe how you validated your changes
Unit tests across the workload package, including that pause blocks each apply path separately, that drift isn't reverted while paused, and that the annotations are honoured for local-owner, remote-owner and profile-managed DPAs.
The previous revision was also run on a local kind cluster against a real CRD (pause appears and clears,
"false"and unparseable values don't pause, a remote-owner DPA annotated after being cached is picked up). The review rework (Active=False/LocallyPaused,CanApply(), force-fallback as a staleness trigger) is covered by unit tests; the kind run is to be redone on it.Additional Notes
Two follow-ups, not in this PR: a
kubectl datadog autoscaling dpa pause|fallbackcommand group indatadog-operator, and replacing theACTIVE/IN ERRORcolumns with a single computedSTATUScolumn (needs a CRD field, so operator-first).🤖 PR description and code assisted by Claude:claude-opus-5, Claude:claude-opus-5-5