Skip to content

alert-mgmt-08: POST /rules endpoint#7

Open
sradco wants to merge 1 commit intoalert-mgmt-07-get-rulesfrom
alert-mgmt-08-create-rule
Open

alert-mgmt-08: POST /rules endpoint#7
sradco wants to merge 1 commit intoalert-mgmt-07-get-rulesfrom
alert-mgmt-08-create-rule

Conversation

@sradco
Copy link
Owner

@sradco sradco commented Feb 25, 2026

Alert Management API — Part 8/14: POST /rules (create)

Summary

  • POST /api/v1/alerting/rules handler routing creation to platform or user-defined path based on namespace
  • Platform rule creation: validates inputs, converts to OSM AlertingRule CRD, adds rule to group (creates AlertingRule if needed)
  • User-defined rule creation: validates against protected labels, checks for duplicate specs, creates/updates PrometheusRule resources
  • Input validation: required fields (alert name, expression), severity whitelist, protected label enforcement
  • Duplicate detection for user-defined rules to prevent identical rule specs
  • Unit tests for both creation paths including validation, conflict, and GitOps guard scenarios

Dependencies

This PR is part of a stacked series. Please review in order.

  1. alert-mgmt-01: k8s foundation + health stub skeleton
    2–7. Pending — alert queries, relabel/health, management foundation, health/alerts/rules endpoints
  2. → This PR — POST /rules (create)
    9–14. Pending — delete, classification, platform update, bulk update, docs/CI/e2e, single-rule API

@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from de14c77 to 691bfe0 Compare February 25, 2026 22:35
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from a559f9d to 5198ecd Compare February 25, 2026 22:35
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 691bfe0 to e53e829 Compare February 25, 2026 22:52
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 5198ecd to 533cca9 Compare February 25, 2026 22:52
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from e53e829 to ae385cf Compare February 25, 2026 23:16
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 533cca9 to 23598f2 Compare February 25, 2026 23:16
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from ae385cf to 36c8fe6 Compare February 25, 2026 23:34
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 23598f2 to ca93ce9 Compare February 25, 2026 23:34
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 36c8fe6 to 8e38fd8 Compare February 25, 2026 23:46
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from ca93ce9 to 8d91e4f Compare February 25, 2026 23:47
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 8e38fd8 to e31c2f0 Compare February 25, 2026 23:57
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 8d91e4f to bf4503d Compare February 25, 2026 23:57
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from e31c2f0 to b612d80 Compare February 26, 2026 14:41
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from bf4503d to 99acedd Compare February 26, 2026 14:41
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from b612d80 to 2236058 Compare February 26, 2026 14:47
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 99acedd to f821d82 Compare February 26, 2026 14:47
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 2236058 to 99b1d22 Compare February 27, 2026 11:44
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from f821d82 to 7fd1c78 Compare February 27, 2026 11:44
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 99b1d22 to 3214560 Compare February 27, 2026 11:57
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 7fd1c78 to 2751640 Compare February 27, 2026 11:57
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 3214560 to 9dafb1b Compare February 27, 2026 11:59
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 2751640 to dadc949 Compare February 27, 2026 11:59
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 9dafb1b to 23606c7 Compare February 27, 2026 12:10
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from dadc949 to 9d9b595 Compare February 27, 2026 12:10
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 23606c7 to 8595634 Compare February 27, 2026 13:12
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 9d9b595 to 91b17fb Compare February 27, 2026 13:12
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from 8595634 to c4f658e Compare March 2, 2026 09:26
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 91b17fb to 86283bf Compare March 2, 2026 09:26
Signed-off-by: Shirly Radco <sradco@redhat.com>
Signed-off-by: João Vilaça <jvilaca@redhat.com>
Signed-off-by: Aviv Litman <alitman@redhat.com>
Co-authored-by: AI Assistant <noreply@cursor.com>
@sradco sradco force-pushed the alert-mgmt-07-get-rules branch from c4f658e to 2eb0d27 Compare March 2, 2026 10:04
@sradco sradco force-pushed the alert-mgmt-08-create-rule branch from 86283bf to 53b5625 Compare March 2, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant