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

Muting certain events #954

Closed
MOZGIII opened this issue Jan 29, 2023 · 5 comments · Fixed by kubeshop/botkube-docs#211
Closed

Muting certain events #954

MOZGIII opened this issue Jan 29, 2023 · 5 comments · Fixed by kubeshop/botkube-docs#211
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@MOZGIII
Copy link

MOZGIII commented Jan 29, 2023

Overview

I am looking for a way to mute certain events at the source level. I found that I can write a regex for event.message to filter the events, but the Go regex engine does not allow for negative lookahead/lookbehind, so writing and maintaining the right regex to allow everything except what I want to filter becomes a mess.

It would be nice if I could write a negative filter, to allow anything except for what is matched by the criteria.

Acceptance Criteria

  • Allow negative filters on event.message and event.kind.
  • When the criteria matches, the event is ignored, when the criteria does not match the event is processed.

Reason

We need a way to ignore certain cluster events, but allow everything else.

@MOZGIII MOZGIII added the enhancement New feature or request label Jan 29, 2023
@brampling
Copy link
Contributor

Hi @MOZGIII, thanks for the opening the issue. This is something I also ran into while writing some documentation for Botkube. It's definitely something we need to address and we will look into the best way to implement it.

@pkosiec pkosiec added the needs-triage Relates to issues that should be refined label Jan 30, 2023
@pkosiec pkosiec added this to Botkube Jan 30, 2023
@pkosiec pkosiec self-assigned this Feb 1, 2023
@pkosiec
Copy link
Collaborator

pkosiec commented Feb 1, 2023

Hi 👋 I'm going to check if a different regex engine (https://github.com/dlclark/regexp2) which supports positive/negative lookahead/lookbehind will do the trick. If yes, it will be fairly easy to implement 🤞Will post an update tomorrow. Cheers!

@pkosiec pkosiec removed the needs-triage Relates to issues that should be refined label Feb 1, 2023
@pkosiec pkosiec moved this to To Review in Botkube Feb 1, 2023
@pkosiec pkosiec added this to the v0.18.0 milestone Feb 1, 2023
@MOZGIII
Copy link
Author

MOZGIII commented Feb 1, 2023

Hi 👋 I'm going to check if a different regex engine (dlclark/regexp2) which supports positive/negative lookahead/lookbehind will do the trick. If yes, it will be fairly easy to implement 🤞Will post an update tomorrow. Cheers!

It would be better to implement negating filter with a separate regex. There are very practical reasons to not have lookahead/behind in a regex parser, an in this case it can easily be worth a substantial (i.e. more than ~x2) CPU load increase for the same work. It is also more difficult to maintain a lookahead/behind regex than a usual one.

@pkosiec
Copy link
Collaborator

pkosiec commented Feb 2, 2023

Thanks for feedback @MOZGIII. After discussing that f2f inside our team we agreed to go with the Go builtin regex engine and support include/exclude list of regexes, similarly to what we have in the sources[name].kubernetes.namespaces. However, as we're going to publish 0.18RC1 today, I'm afraid it will be moved to the 0.19 release.

@pkosiec pkosiec moved this from To Review to In Progress in Botkube Feb 2, 2023
@pkosiec pkosiec modified the milestones: v0.18.0, v0.19.0 Feb 2, 2023
@pkosiec pkosiec moved this from In Progress to To Review in Botkube Feb 6, 2023
@github-project-automation github-project-automation bot moved this from To Review to Done in Botkube Feb 8, 2023
@pkosiec
Copy link
Collaborator

pkosiec commented Feb 8, 2023

Hey @MOZGIII, the PR #211 was merged and this functionality will be included in 0.19.
See the updated docs here: https://docs.botkube.io/next/configuration/source/kubernetes#event-and-resource-constraints

You can also try out the unstable main version if you'd like to 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants