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

Add LabelSelectors for Event Sources #325

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Add LabelSelectors for Event Sources #325

merged 1 commit into from
Feb 10, 2022

Conversation

somtochiama
Copy link
Member

@somtochiama somtochiama commented Feb 9, 2022

Fix: #275

Signed-off-by: Somtochi Onyekwere [email protected]

forwarded: true,
},
{
name: "forwards events the label matches",
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a test for "drop events when labels don't match"

@stefanprodan stefanprodan added area/alerting Alerting related issues and PRs enhancement New feature or request labels Feb 9, 2022
@somtochiama somtochiama marked this pull request as ready for review February 9, 2022 16:40
@@ -96,12 +99,40 @@ func (s *EventServer) handleEvent() func(w http.ResponseWriter, r *http.Request)
source.Namespace = alert.Namespace
}

if (source.Name == "*" || event.InvolvedObject.Name == source.Name) &&
event.InvolvedObject.Namespace == source.Namespace &&
if event.InvolvedObject.Namespace == source.Namespace &&
Copy link
Member

Choose a reason for hiding this comment

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

Let's extract this logic to a function called eventMatchesAlert

Signed-off-by: Somtochi Onyekwere <[email protected]>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @somtochiama 🏅

@stefanprodan stefanprodan merged commit bcd3551 into main Feb 10, 2022
@stefanprodan stefanprodan deleted the label-selector branch February 10, 2022 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Alerting related issues and PRs enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Selector-like Config Options for Alert CRD Based on Label
2 participants