alerts: declarative rules via config; drop in-repo chart#55
Merged
Conversation
Alert rules become declarative: a JSON config (WATCHER_ALERTS_CONFIG, rendered from the chart's server.alerts values) is the source of truth, reconciled into alert_rules on startup. reconcile() validates all rules, upserts each by name (preserving id + event history), and prunes any rule no longer declared. The /api/alerts surface is now read-only (dropped the create/delete routes, handlers, and UI form); migration 0012 adds the unique name index the upsert needs. The Helm chart now lives only in the ../cluster GitOps repo, so remove the stale in-repo chart/, its CI helm-lint job and build dependency, and the chart references in the docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JbrmfzHsTMMzPaSrUkZgWo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alert rules become declarative: a JSON config (
WATCHER_ALERTS_CONFIG, rendered from the chart'sserver.alertsvalues) is the source of truth, reconciled intoalert_ruleson startup. The/api/alertssurface is now read-only.Server
alerts.rs:RuleConfig(serde + defaults),load_rules(path),validate(same enum whitelist the old create API used), andreconcile(pool, rules)— validate-all → upsert each by name (preserving id + event history) → prune anything no longer declared, in one transaction.main.rs: on startup, load + reconcile fromWATCHER_ALERTS_CONFIG; a bad config is logged, not fatal (prior rules stand, ingest unaffected).migrations/0012: unique index onalert_rules.namefor the upsert (dedups legacy rows first).POST/DELETE /api/alerts, their handlers,NewAlertRule, the UI create form + delete button, andcreateAlert/deleteAlert.Chart removed from this repo
The Helm chart lives only in the
clusterGitOps repo now, so this drops the stale in-repochart/, its CIhelm lintjob + build dependency, and the chart references in the docs. The ConfigMap/mount/env wiring lands in the cluster repo.Tests
Converted the alert integration tests to drive the real
reconcilepath; added coverage for config defaults, validation, empty-config pruning, and in-place upsert. 16 unit + 35 integration tests green.Merging to
maintriggers the image build → ArgoCD Image Updater pins the new digest and rolls it.🤖 Generated with Claude Code