feat(kuma-sync): one mail per outage via a root group #1525

Merged
k.renner merged 1 commits from kuma-root-group into main 2026-10-30 13:14:40 +00:00
Member

Every KumaMonitor without a parentRef is placed under the root group kuma-sync/renner-uno (controller env KUMA_ROOT_GROUP). Only the root group references the email KumaNotification. An outage therefore sends one DOWN mail listing the affected groups ("Child monitors down: …") and one UP mail.

  • New KumaMonitor field resendInterval. It counts consecutive DOWN heartbeats, not minutes (Kuma 2.5.6 server/model/monitor.js). The root group uses 60 × 60 s, which sends an hourly reminder while it is down.
  • Root missing or without an ID: parentless monitors are ParentPending and requeue. Root not a group, or root with a parentRef: InvalidParent. Changes to the root group requeue all parentless monitors.
  • The root group counts toward the parent depth limit.
  • The kuma-sync Flux Kustomization gets the KumaMonitor healthCheckExprs entry.

🤖 Generated with Claude Code

Every KumaMonitor without a parentRef is placed under the root group `kuma-sync/renner-uno` (controller env `KUMA_ROOT_GROUP`). Only the root group references the `email` KumaNotification. An outage therefore sends one DOWN mail listing the affected groups ("Child monitors down: …") and one UP mail. - New KumaMonitor field `resendInterval`. It counts consecutive DOWN heartbeats, not minutes (Kuma 2.5.6 `server/model/monitor.js`). The root group uses 60 × 60 s, which sends an hourly reminder while it is down. - Root missing or without an ID: parentless monitors are `ParentPending` and requeue. Root not a group, or root with a parentRef: `InvalidParent`. Changes to the root group requeue all parentless monitors. - The root group counts toward the parent depth limit. - The kuma-sync Flux Kustomization gets the KumaMonitor `healthCheckExprs` entry. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude-bot added 1 commit 2026-10-29 15:33:26 +00:00
feat(kuma-sync): one mail per outage via a root group
ci/woodpecker/pr/ci-manifests-test Pipeline was successful
ci/woodpecker/pr/ci-scripts-test Pipeline was successful
811178e321
Monitors without a parentRef are placed under the root group set by
KUMA_ROOT_GROUP (kuma-sync/renner-uno). Only the root references the
email notification, so a fleet-wide outage sends one DOWN and one UP mail
listing the affected groups. resendInterval (consecutive DOWN heartbeats)
is now a managed KumaMonitor field; the root resends hourly while down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k.renner requested review from review-bot 2026-10-30 11:57:39 +00:00
review-bot approved these changes 2026-10-30 12:00:56 +00:00
review-bot left a comment
Member

🤖 Automated review — model claude-sonnet-5-5, commit 811178e321002c2d69b2a85449f54d25522cf556.

Automated review by the review-bot: it approves only when it found nothing red or yellow, and a human still merges. Request a review from review-bot again for a fresh one.


Summary

This PR adds a root group, kuma-sync/renner-uno, which every KumaMonitor without a parentRef is placed under. Only the root group references the email notification. It also adds a managed resendInterval field, with config parsing, watches and requeues for the root group, and the Flux healthCheckExprs entry. I found no blocking defects in the diff. I did not run the tests.

🟡 Suggestions

  • ci/images/kuma-sync/internal/controller/kumamonitor_controller.go:rootChanged: this compares only MonitorID, Type, whether ParentRef is set, and deletion state. That covers every field resolveRoot reads, so the predicate is correct. If resolveRoot ever checks more of the root's spec, add that field here too, or the children will not re-reconcile.
  • ci/images/kuma-sync/internal/kumaclient/breml.go:582: ResendInterval is now a managed field. writeBase overwrites any resend interval set by hand in the Kuma UI with the spec value, and 0 clears it. The PR describes this and tests it, and TestResendIntervalClearedOnUpdate covers the clearing. Worth a mention in the release notes.

Tests

Coverage is good:

  • Unit tests for config parsing, field mapping and the wire round trip.
  • Unit tests for root-group behaviour: parenting, pending and invalid states, depth counting, enqueue mapping and the predicate.
  • Integration test updates, plus CRD validation for a negative resendInterval.

Recommendation

Looks reasonable — no blocking issues; comments above are optional.

🤖 **Automated review** — model `claude-sonnet-5-5`, commit `811178e321002c2d69b2a85449f54d25522cf556`. > Automated review by the `review-bot`: it approves only when it found nothing red or yellow, and a human still merges. Request a review from `review-bot` again for a fresh one. --- ## Summary This PR adds a root group, `kuma-sync/renner-uno`, which every `KumaMonitor` without a `parentRef` is placed under. Only the root group references the `email` notification. It also adds a managed `resendInterval` field, with config parsing, watches and requeues for the root group, and the Flux `healthCheckExprs` entry. I found no blocking defects in the diff. I did not run the tests. ## 🟡 Suggestions - `ci/images/kuma-sync/internal/controller/kumamonitor_controller.go:rootChanged`: this compares only `MonitorID`, `Type`, whether `ParentRef` is set, and deletion state. That covers every field `resolveRoot` reads, so the predicate is correct. If `resolveRoot` ever checks more of the root's spec, add that field here too, or the children will not re-reconcile. - `ci/images/kuma-sync/internal/kumaclient/breml.go:582`: `ResendInterval` is now a managed field. `writeBase` overwrites any resend interval set by hand in the Kuma UI with the spec value, and 0 clears it. The PR describes this and tests it, and `TestResendIntervalClearedOnUpdate` covers the clearing. Worth a mention in the release notes. ## Tests Coverage is good: - Unit tests for config parsing, field mapping and the wire round trip. - Unit tests for root-group behaviour: parenting, pending and invalid states, depth counting, enqueue mapping and the predicate. - Integration test updates, plus CRD validation for a negative `resendInterval`. ## Recommendation Looks reasonable — no blocking issues; comments above are optional. <!-- pr-review:sha=811178e321002c2d69b2a85449f54d25522cf556 -->
k.renner merged commit b77b0a4d0d into main 2026-10-30 13:14:40 +00:00
Sign in to join this conversation.