Skip to content

CNV-80440: add alert rule preview API - #28

Closed
sradco wants to merge 1 commit into
alert-mgmt-single-rule-endpointsfrom
alert-mgmt-rule-preview
Closed

CNV-80440: add alert rule preview API#28
sradco wants to merge 1 commit into
alert-mgmt-single-rule-endpointsfrom
alert-mgmt-rule-preview

Conversation

@sradco

@sradco sradco commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on alert-mgmt-single-rule-endpoints (openshift#1121).
Adds:

  • POST /api/v1/alerting/rules/preview — dry-run create or update
    without persisting changes

Preview shares planning logic with the execute paths (plan_create_user_defined.go,
plan_create_platform.go, plan_update.go) and returns a multi-resource
change plan (resources[], desiredRule, writable, optional managedBy).

Preview API

  • Create preview: alertingRule + optional prometheusRule
  • Update preview: ruleId + at least one of labels, alertingRuleEnabled,
    or classification
  • Response includes per-resource changes[] and full desiredObject for
    UI review
  • Works on externally managed resources (writable: false with managedBy)

Tests

  • Unit: preview handler and planning paths (preview_alert_rule_test.go,
    both pkg/management and internal/managementrouter)
  • Unit: platform preview/execute writable parity (platform_update_parity_test.go)
  • E2E: preview no-persistence checks for create and update
  • E2E RBAC: anonymous / namespace-scoped / cluster-admin for
    /rules/preview create and update

Test plan

  • go test ./pkg/management/... ./internal/managementrouter/...
  • go build -tags e2e ./test/e2e/...
  • CI on this PR

Signed-off-by: Shirly Radco sradco@redhat.com
Co-authored-by: AI Assistant noreply@cursor.com

Made with Cursor

@sradco
sradco force-pushed the alert-mgmt-rule-preview branch from f134798 to 5435e21 Compare August 25, 2026 12:38
Add POST /api/v1/alerting/rules/preview for create and
update dry-run. Share planning logic with execute paths,
return multi-resource change plans with desiredObject,
and add unit plus e2e RBAC coverage.

Signed-off-by: Shirly Radco <sradco@redhat.com>
Co-authored-by: AI Assistant <noreply@cursor.com>
@sradco
sradco force-pushed the alert-mgmt-rule-preview branch from 5435e21 to 510e0f9 Compare August 25, 2026 12:40
@sradco

sradco commented Aug 25, 2026

Copy link
Copy Markdown
Owner Author

Moved to openshift/monitoring-plugin PR 1180. Branch rebased onto updated alert-mgmt-single-rule-endpoints (openshift openshift#1121).

@sradco sradco closed this Aug 25, 2026
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