Commit 8fb2856
authored
feat(autoscaling): CPURequestsRemoveLimitsMemoryRequestsAndLimits + cluster burstable default (#49314)
## Summary
### 1. `CPURequestsRemoveLimitsMemoryRequestsAndLimits` controlled value
Implements the new `CPURequestsRemoveLimitsMemoryRequestsAndLimits` container `controlledValues` enum from the datadog-operator ([c59fc90](DataDog/datadog-operator@c59fc90)).
When set on a container constraint:
- **CPU**: only requests are controlled; any existing CPU limit is actively removed from the live pod, letting the container burst freely and avoid CPU throttling.
- **Memory**: both requests and limits are controlled (standard `RequestsAndLimits` semantics).
The removal flows via a sentinel quantity (`-1`) stored on `ContainerResources.Limits[cpu]` by `applyVerticalConstraints` and recognised by the pod patcher, which actively deletes any pre-existing CPU limit from the live pod (an absent entry would mean "leave untouched").
### 2. Recognise `spec.options.burstable` in `IsBurstable()`
`IsBurstable()` now resolves from `spec.options.burstable` first, then the existing preview annotation. There is no cluster-level default — burstable mode requires an explicit per-DPA opt-in via either signal.
### 3. Report effective burstable mode in `status.options.burstable`
`BuildStatus` populates `status.options.burstable` so consumers can observe the resolved value:
- When `spec.options.burstable` is set: reported as-is (true or false).
- When the preview annotation enables burstable: reported as `true`.
- Otherwise: omitted (no opt-in).
### 4. Fix stale-sentinel propagation when the backend stops emitting a vertical recommendation
`SetActiveScalingValues` previously self-assigned `p.scalingValues.Vertical` when the active vertical source was `nil` (because `selectScalingValues(nil)` returns `p.scalingValues`). This kept any burstable sentinel from the previous cycle alive and caused `applyVerticalConstraints(burstable=false)` to early-return, suppressing the rollout when burstable was toggled off. Now `Vertical` is explicitly reset to `nil` so the next sync sees "no recommendation" and clears live state.
### 5. Dependency bump
`go.mod`: `datadog-operator/api` → `v0.0.0-20260515125012-8e158b708444`.
## Test plan
- [x] `TestApplyVerticalConstraints_CPURequestsRemoveLimits` — CPU limit stripped from recommendation, memory limit preserved, sentinel inserted.
- [x] `TestPatchContainerResources_*` / `TestPatchPod_*` — CPU limit actively removed from live pod, idempotent when already absent.
- [x] `IsBurstable priority matrix` — spec > annotation > default false.
- [x] `BuildStatus` reports `options.burstable` for spec (true/false) and for annotation-enabled, omits when neither is set.
- [x] `TestSetActiveScalingValues_NilSource_ClearsVertical` — nil vertical source clears `scalingValues.Vertical` instead of self-assigning the stale sentinel.
- [x] Full package suite passes: `dda inv test --targets=./pkg/clusteragent/autoscaling/workload/...`
- [x] Lint clean: `dda inv linter.go --targets ./pkg/clusteragent/autoscaling/workload/...`
- [x] Manual QA in kind cluster: DPA with preview annotation reports `status.options.burstable: true`; DPA without explicit opt-in reports no options (defaults to non-burstable).
🤖 PR description and code assisted by Claude:claude-opus-4-7
Co-authored-by: cedric.lamoriniere <cedric.lamoriniere@datadoghq.com>1 parent 48d67af commit 8fb2856
10 files changed
Lines changed: 509 additions & 121 deletions
File tree
- pkg/clusteragent/autoscaling/workload
- model
- releasenotes-dca/notes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1520 | 1520 | | |
1521 | 1521 | | |
1522 | 1522 | | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
1523 | 1526 | | |
1524 | 1527 | | |
1525 | 1528 | | |
| |||
Lines changed: 90 additions & 74 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
336 | 335 | | |
337 | 336 | | |
338 | 337 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | 383 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
404 | 389 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
409 | 393 | | |
| 394 | + | |
410 | 395 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
415 | 404 | | |
| 405 | + | |
416 | 406 | | |
417 | | - | |
418 | 407 | | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
424 | 420 | | |
425 | | - | |
426 | 421 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
440 | 436 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
445 | 448 | | |
446 | 449 | | |
447 | | - | |
448 | 450 | | |
449 | | - | |
450 | | - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
451 | 460 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
463 | 472 | | |
464 | | - | |
| 473 | + | |
465 | 474 | | |
466 | 475 | | |
| 476 | + | |
| 477 | + | |
467 | 478 | | |
468 | 479 | | |
469 | 480 | | |
| |||
507 | 518 | | |
508 | 519 | | |
509 | 520 | | |
| 521 | + | |
| 522 | + | |
510 | 523 | | |
511 | 524 | | |
512 | 525 | | |
513 | 526 | | |
514 | 527 | | |
515 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
516 | 532 | | |
517 | 533 | | |
518 | 534 | | |
| |||
0 commit comments