[Backport v1.32] [CASCL-338] Add kubectl datadog autoscaling dpa commands #3677
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 469 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.368
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #3677"
general
weight: 0.35
clamoriniere
Backport b8216e26cd09c5333a4ba795bad7d7b6b32c3188 from #3558.
___
What does this PR do?
Adds
kubectl datadog autoscaling dpa, a set of break-glass commands that set the DatadogPodAutoscaler operational annotations without touching the spec:| Command | Annotation | Effect |
|---|---|---|
|
pause enable\|disable|autoscaling.datadoghq.com/pause| Stop / resume applying any change to the workload ||
force-fallback enable\|disable|autoscaling.datadoghq.com/force-fallback| Force the local recommender as the horizontal source ||
force-replicas set\|unset|autoscaling.datadoghq.com/force-replicas| Pin the replica count ||
force-resources set\|unset|autoscaling.datadoghq.com/force-resources| Override container cpu/memory requests and limits (merged into the current value) |Common behaviour:
-l/--label-selector, or--all.-A/--all-namespaceswidens a selection and is rejected on its own.--yesto skip);--dry-runprintsnamespace/name: current → new.--timeout, default 30s;--wait=falseto skip) for the Cluster Agent to report the override in the status:-
pause:Active=False, reasonLocallyPaused-
force-replicas:HorizontalScalingLimited, "replica count pinned to N …"-
force-resources:VerticalScalingLimited, reasonForcedByAnnotation-
force-fallback enable:status.horizontal.target.source=Local. Only a warning if not confirmed, since the local recommender may not have fresh values yet.Also fixes a typo in
pkg/plugin/common/client.go("unable to register").Motivation
Give on-call engineers a safe, auditable way to pause or override DPA autoscaling during an incident, without editing the DPA spec by hand or remembering annotation formats.
Additional Notes
pkg/clusteragent/autoscaling/workload(DataDog/datadog-agent#56984, #56985, #56988).TestContractStringspins them.force-resourcesonly applies while the DPA has a vertical recommendation; forced values are overlaid on it.force-fallback disableonly stops forcing the fallback; it does not disablespec.fallback.horizontal.enabled.Minimum Agent Versions
Agent: N/A
Cluster Agent: v7.85.0
Describe your test plan
go test -race ./cmd/kubectl-datadog/autoscaling/dpa/...1.
kubectl datadog autoscaling dpa pause enable <dpa>→ waits, prints "Confirmed by the Cluster Agent";kubectl describe dpashowsActive=False/LocallyPaused.2.
pause enable -A→ rejected;pause enable --all -A --dry-run→ lists objects.3.
force-replicas set --replicas 5 <dpa>→ workload scales to 5;unsetreleases it.4.
force-resources set -c app --requests cpu=500m <dpa>thenunset -c app.5.
force-fallback enable <dpa>without fresh local values → warning, exit 0.6. Ctrl-C at the confirmation prompt (with
--all) → aborts, nothing patched.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel[1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
🤖 PR description and code assisted by Claude:claude-opus-5-5