From 14c8c9d4d2a88d05c000d48a8c13d57c4caf92f5 Mon Sep 17 00:00:00 2001 From: Kuntal Majumder <12135951+hellozee@users.noreply.github.com> Date: Mon, 4 Jan 2021 15:46:23 +0530 Subject: [PATCH] Fixed namespace checker to use the correct name (#437) ##### ISSUE TYPE - Bug fix Pull Request ##### SUMMARY Apparently the wrong member was used to check the resource name. I don't know how resillient this patch is, but it works for most of the part. Fixes #419 --- pkg/events/events.go | 3 ++- pkg/filterengine/filters/namespace_checker.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/events/events.go b/pkg/events/events.go index 634484b97..9a0fe6da5 100644 --- a/pkg/events/events.go +++ b/pkg/events/events.go @@ -51,6 +51,7 @@ type Event struct { Count int32 Action string Skip bool `json:",omitempty"` + Resource string Recommendations []string Warnings []string @@ -121,7 +122,7 @@ func New(object interface{}, eventType config.EventType, resource, clusterName s event.Count = eventObj.Count event.Action = eventObj.Action event.TimeStamp = eventObj.LastTimestamp.Time - + event.Resource = resource } return event } diff --git a/pkg/filterengine/filters/namespace_checker.go b/pkg/filterengine/filters/namespace_checker.go index fe3bc6fa7..fd0fe31f8 100644 --- a/pkg/filterengine/filters/namespace_checker.go +++ b/pkg/filterengine/filters/namespace_checker.go @@ -56,7 +56,7 @@ func (f NamespaceChecker) Run(object interface{}, event *events.Event) { } if botkubeConfig != nil { for _, resource := range botkubeConfig.Resources { - if resource.Name == strings.ToLower(event.Kind) { + if resource.Name == event.Resource { // check if namespace to be ignored if isNamespaceIgnored(resource.Namespaces, event.Namespace) { event.Skip = true