Commit 4a897b9
authored
fix: always set MetricsAvailable condition in VA status (llm-d#567)
* fix: always set MetricsAvailable condition in VA status
The MetricsAvailable condition was not showing in VA status because the
code tried to copy it from a local VA object where it was never set.
Instead of copying a potentially nil condition, we now directly set
MetricsAvailable based on whether we have metrics data:
- True if we have an allocation (from metrics collection) or a decision
(from saturation analysis)
- False otherwise, indicating pods may not be ready or metrics not yet
scraped
* fix: use more accurate MetricsAvailable condition message
Address Copilot review feedback - the message now accurately reflects
that metrics data is available rather than implying active collection.
* fix: persist MetricsAvailable condition via decision cache
The previous fix set the condition on a local object that was never
persisted. The condition must flow through the DecisionCache to the
controller which actually updates the API server.
Changes:
- Add MetricsAvailable fields to VariantDecision struct
- Store metrics availability in the decision cache
- Controller reads from cache and sets the condition on VA status
* fix: set MetricsAvailable=False even when no accelerator info
When pods aren't ready yet, the engine skips full status updates due to
missing accelerator info. However, we still need to set MetricsAvailable=False
so users can see the condition in the VA status.
Now populates the cache and triggers reconciliation even in this case.
* debug: add INFO logging for cache operations
* fix: only update DesiredOptimizedAlloc if values are valid
When cache entry only has MetricsAvailable=false (no accelerator/replicas),
don't try to update DesiredOptimizedAlloc as it would fail CRD validation.
Still apply MetricsAvailable condition in all cases.
* refactor: extract MetricsAvailable constants and add explanatory comment
Address Copilot review feedback:
- Extract duplicated MetricsReason/MetricsMessage strings as constants
- Add comment explaining hasAllocation || hasDecision logic
* fix: address additional Copilot review feedback
- Add comment explaining partial decision for metrics status only
- Allow numReplicas=0 for scale-to-zero scenarios (only require accelerator)1 parent 907e5be commit 4a897b9
File tree
3 files changed
+72
-18
lines changed- internal
- controller
- engines/saturation
- interfaces
3 files changed
+72
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
194 | | - | |
195 | | - | |
196 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
197 | 213 | | |
198 | 214 | | |
199 | 215 | | |
200 | 216 | | |
201 | | - | |
| 217 | + | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
| |||
511 | 519 | | |
512 | 520 | | |
513 | 521 | | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
| 522 | + | |
| 523 | + | |
523 | 524 | | |
524 | 525 | | |
525 | 526 | | |
| |||
548 | 549 | | |
549 | 550 | | |
550 | 551 | | |
| 552 | + | |
551 | 553 | | |
552 | | - | |
553 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
554 | 571 | | |
555 | 572 | | |
556 | 573 | | |
| |||
627 | 644 | | |
628 | 645 | | |
629 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
630 | 661 | | |
631 | 662 | | |
632 | 663 | | |
633 | 664 | | |
634 | 665 | | |
635 | 666 | | |
636 | 667 | | |
637 | | - | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
638 | 671 | | |
639 | 672 | | |
640 | 673 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
0 commit comments