-
Notifications
You must be signed in to change notification settings - Fork 292
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
[feature] Add Object Annotation filter, Fixes #132, #133 #138
[feature] Add Object Annotation filter, Fixes #132, #133 #138
Conversation
531b9e5
to
5a39342
Compare
rebased to develop |
Thanks for the PR @aananthraj! Please rebase your branch with develop. |
5a39342
to
84d12fa
Compare
@PrasadG193, Rebased to develop. thanks 👍 |
afca609
to
b1c42ba
Compare
Resolved requested changes. |
b1c42ba
to
81e745e
Compare
Rebased onto develop |
b8ee76d
to
273bbce
Compare
pkg/filterengine/filters/object-annotation-filter/object_annotation_checker.go
Outdated
Show resolved
Hide resolved
This commit, - enables filtering of events based on annotations present in objects at run time. - annotation `botkube.io/disable: true` disables event notifications for the annotated object - annotation `botkube.io/channel: <channel_name>` sends events notifications of the annotated object to the mentioned channel. - adds func `ExtractAnnotations()`. It extract annotations from Event.InvolvedObject and adds them to event.Metadata.Annotations - implements individual actions using internal functions. - adds unit tests for internal functions. - replaces Init() with InitialiseKubeClient() to decouple config.yaml and KubeClinet dependencies from unit testing
273bbce
to
88dbb3e
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.
Lets make sure we have unit tests around this scenario.
expectedChannel string | ||
expectedBool bool | ||
}{ | ||
`Empty ObjectMeta`: {metaV1.ObjectMeta{}, "", false}, |
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.
I guess, this covers the emty object use case as well as the object not available (object deleted) use case.
Do correct me, if am missing something.
@aananthraj Please rebase PR. |
Sure, thanks |
ISSUE TYPE
SUMMARY
This commit,
botkube.io/disable: true
disables event notifications for the annotated objectbotkube.io/channel: <channel_name>
sends events notifications of the annotated object to the mentioned channel.utils.ExtractAnnotations()
. It extracts annotations from Event.InvolvedObject. Extracted Annotations are then added to the event.Metadata.Annotationsutils.Init()
withInitialiseKubeClient()
to decoupleconfig.yaml
andKubeClinet
dependencies from unit testingFixes #132
Adding
botkube.io/channel: <channel_name>
annotation to a kubenetes resources sends all the notifications of the annotated object to specified channel in the workspace.This provides a way to classify notifications based on internal teams or workgroup by using the annotation data available in the resources.
Fixes #133
Adding
botkube.io/disable: true
annotation to a kubernetes resource, skips the notifications about the annotated object from being sent to the channels.This provides us the control to enable or disable notifications of a particular object at run time.
Up