Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Add initial condition parser for access monitoring rules #42087

Merged
merged 2 commits into from
May 30, 2024

Conversation

EdwardDowling
Copy link
Contributor

@EdwardDowling EdwardDowling commented May 28, 2024

backport of #40659

depends on #42092

Adds parser for AMR conditions and enables additive recipients via the AMRs (Access monitoring rules)

Changelog: Added access monitoring rule routing for slack access plugin

@EdwardDowling EdwardDowling changed the title Add initial condition parser for access monitoring rules [v15] Add initial condition parser for access monitoring rules May 28, 2024
* Add initial condition parser for access monitoring rules

* Update integrations/access/accessrequest/app.go

Co-authored-by: Zac Bergquist <[email protected]>

* Check previously unchecked error and minor refactor of AMR

* Simplify check for applicable access monitoring rules

* Refactor access monitoring rules plugin integration

* Fix formating and move lock aquisition

* Add methods for listing access monitoring rules with a filter

* Add contains_any predicate expression func

* Add in is_empty func to predicate expression

* Lock AMR cache in plugins while getting initial rules

* Add in check for access monitoring rule version

* Update integrations/access/accessrequest/app.go

Co-authored-by: Roman Tkachenko <[email protected]>

* Update integrations/access/accessrequest/app.go

Co-authored-by: Roman Tkachenko <[email protected]>

* Move lock so it doesnt persist over api calls

* Remove unused constant and add more context to logs

* Appease linter

* Update access monitoring rules tests to pass rule validation

* Add in missing access monitoring rules list with filter code

* Appease linter

* Add back validation code for AMRs

* Fix test plugin role and rename listaccessmonitoringrulewithfilter

* Fix local test for AMR crud operations

* Fix end range for listing rules

* Fix unwrapping of resource153 event for monitoring rules

* Refactor AMR cache init into helper function in plugin app

* Add seperate response type for listAccessMonitoringRulesWithfilter

* Add context to log for plugins failing to fetch recipients

* Grab access monitoring rules cache under lock all at once

* Add clarification for which fields are optional in listAMRfilter req

* Update integrations/access/accessrequest/app.go

Co-authored-by: Zac Bergquist <[email protected]>

* Update integrations/access/accessrequest/app.go

Co-authored-by: Zac Bergquist <[email protected]>

* Add forEach to common recipient set

* Move type check to after AMR event op switch

* Move turn some default parser spec methods to funcs

* Make some predicate func usable as methods as well

* Add len func to common recipient sets

* Add integration test for access monitoring rule and slack plugin

* Fix error types and messages when handling AMRs

* Use generic list resource with filter for AMR

* Add test for generic listResourceWithFilter

* Update listResourceWithFilter to use revision instead of id

* Update generic tests to use revision instead of id

* Fix linting

---------

Co-authored-by: Zac Bergquist <[email protected]>
Co-authored-by: Roman Tkachenko <[email protected]>
@EdwardDowling EdwardDowling force-pushed the edwarddowling/backport-40659/v15 branch from 9fe43f5 to 2f002f1 Compare May 29, 2024 12:32
@EdwardDowling EdwardDowling marked this pull request as ready for review May 29, 2024 13:13
@github-actions github-actions bot requested review from kimlisa, r0mant, tigrato and zmb3 May 29, 2024 13:14
Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EdwardDowling @kimlisa Please test the feature off of backport branch before merging.

@kimlisa
Copy link
Contributor

kimlisa commented May 29, 2024

@EdwardDowling could you go through these and check them off? (i'll go through it on my cloud staging, but i won't be marking it here)

  • Test the default integration recipients are notified when no rule exists
  • Test creating a custom rule that overwrites the default rule (default recipients should not be notified)
  • Test update rule to a different recipient (the previous recipient should not be notified)
  • Test email recipient notification works if applicable (eg slack)
  • Test a rule with multiple recipients and channels (eg slack)
  • Test multiple rules with different condition notifies the correct recipients
  • Test deleting all rules, notifications fallbacks to the default (deleted rules should not be notified)
  • Test each pre-defined predicate expressions from default editor works as match conditions (not manually adding a match condition in the yaml editor)

@EdwardDowling EdwardDowling enabled auto-merge May 30, 2024 16:22
@EdwardDowling EdwardDowling added this pull request to the merge queue May 30, 2024
Merged via the queue into branch/v15 with commit 1b4a901 May 30, 2024
33 checks passed
@EdwardDowling EdwardDowling deleted the edwarddowling/backport-40659/v15 branch May 30, 2024 17:00
@camscale camscale mentioned this pull request May 31, 2024
@ghost ghost mentioned this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants