Commit 6286073
fix(redis): quiet skip on Regrade when namespace is missing (#36)
The reconciler iterates every active `resources` row of type=redis and
calls provisioner Regrade per row. If a tenant namespace was force-deleted
or a cluster wipe raced ahead of platform-DB cleanup, the namespace is
gone — but the resource row is still status='active' so the reconciler
keeps trying every ~5min tick.
Pre-fix path: Secrets.Get → IsNotFound (b/c namespace missing) → exec
fallback → Pods.List → empty → WARN `no Redis pod found — soft skip`.
Twice per orphan per tick, indistinguishable in logs from a real legacy
pod missing its Secret.
Verified live in prod (commit eeb33ab) on 2026-05-30: two orphaned
namespaces emitting ~576 WARN/day combined, drowning real signals
(`maxmemory_policy CONFIG REWRITE failed`, `non-integer maxmemory`).
Fix: at Regrade entry, do a single Namespaces.Get. If IsNotFound, return
SkipReason="namespace not found (resource orphaned)" with an INFO log
(distinct from exec-fallback WARNs so operators can differentiate).
Saves the Secrets.Get + Pods.List round-trip per orphan per tick.
Tests:
* TestRegrade_NamespaceMissing_QuietSkip — new orphan path: zero exec
calls, exact SkipReason match.
* TestRegrade_NamespaceLookupTransientError_PropagatesError — non-
IsNotFound errors from namespace lookup MUST propagate so the
reconciler retries (paid customers' regrades not silently dropped).
* TestRegrade_NoPodsAtAll_SoftSkip rewritten: now asserts namespace
EXISTS but is pod-less (the genuine soft-skip case) and that the
SkipReason is NOT the orphan sentinel.
* Updated all 7 existing Regrade tests in coverage_test.go +
k8s_test.go that previously relied on the empty-cluster path to
add the corev1.Namespace fixture (via a new nsObject helper).
Co-authored-by: Manas Srivastava <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent eeb33ab commit 6286073
3 files changed
Lines changed: 140 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1037 | 1037 | | |
1038 | 1038 | | |
1039 | 1039 | | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1040 | 1045 | | |
1041 | 1046 | | |
1042 | 1047 | | |
| |||
1054 | 1059 | | |
1055 | 1060 | | |
1056 | 1061 | | |
1057 | | - | |
1058 | | - | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1059 | 1065 | | |
1060 | 1066 | | |
1061 | 1067 | | |
| |||
1065 | 1071 | | |
1066 | 1072 | | |
1067 | 1073 | | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1068 | 1077 | | |
1069 | 1078 | | |
1070 | 1079 | | |
| |||
1263 | 1272 | | |
1264 | 1273 | | |
1265 | 1274 | | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
1266 | 1278 | | |
1267 | 1279 | | |
1268 | 1280 | | |
| |||
1307 | 1319 | | |
1308 | 1320 | | |
1309 | 1321 | | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
1310 | 1325 | | |
1311 | 1326 | | |
1312 | 1327 | | |
| |||
1516 | 1531 | | |
1517 | 1532 | | |
1518 | 1533 | | |
1519 | | - | |
| 1534 | + | |
| 1535 | + | |
1520 | 1536 | | |
1521 | | - | |
| 1537 | + | |
| 1538 | + | |
1522 | 1539 | | |
1523 | 1540 | | |
1524 | 1541 | | |
1525 | 1542 | | |
1526 | | - | |
| 1543 | + | |
1527 | 1544 | | |
1528 | 1545 | | |
1529 | 1546 | | |
| |||
1532 | 1549 | | |
1533 | 1550 | | |
1534 | 1551 | | |
1535 | | - | |
1536 | 1552 | | |
| 1553 | + | |
1537 | 1554 | | |
1538 | 1555 | | |
1539 | 1556 | | |
| |||
1858 | 1875 | | |
1859 | 1876 | | |
1860 | 1877 | | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
1861 | 1881 | | |
1862 | 1882 | | |
1863 | 1883 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
626 | 650 | | |
627 | 651 | | |
628 | 652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
489 | 490 | | |
490 | 491 | | |
491 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
492 | 501 | | |
493 | 502 | | |
494 | 503 | | |
| |||
512 | 521 | | |
513 | 522 | | |
514 | 523 | | |
515 | | - | |
| 524 | + | |
516 | 525 | | |
517 | 526 | | |
518 | 527 | | |
| |||
545 | 554 | | |
546 | 555 | | |
547 | 556 | | |
548 | | - | |
| 557 | + | |
549 | 558 | | |
550 | 559 | | |
551 | 560 | | |
| |||
596 | 605 | | |
597 | 606 | | |
598 | 607 | | |
599 | | - | |
| 608 | + | |
600 | 609 | | |
601 | 610 | | |
602 | 611 | | |
| |||
633 | 642 | | |
634 | 643 | | |
635 | 644 | | |
636 | | - | |
| 645 | + | |
637 | 646 | | |
638 | 647 | | |
639 | 648 | | |
| |||
650 | 659 | | |
651 | 660 | | |
652 | 661 | | |
653 | | - | |
654 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
655 | 665 | | |
656 | 666 | | |
657 | 667 | | |
658 | 668 | | |
659 | | - | |
| 669 | + | |
| 670 | + | |
660 | 671 | | |
661 | 672 | | |
662 | 673 | | |
| |||
668 | 679 | | |
669 | 680 | | |
670 | 681 | | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
671 | 754 | | |
672 | 755 | | |
673 | 756 | | |
| |||
0 commit comments