-
Notifications
You must be signed in to change notification settings - Fork 140
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
Conversation
controllers/event_handling_test.go
Outdated
forwarded: true, | ||
}, | ||
{ | ||
name: "forwards events the label matches", |
There was a problem hiding this comment.
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"
internal/server/event_handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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]>
ace61d8
to
519b6a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @somtochiama 🏅
Fix: #275
Signed-off-by: Somtochi Onyekwere [email protected]