Skip to content

Commit

Permalink
Fixed namespace checker to use the correct name (#437)
Browse files Browse the repository at this point in the history
##### 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.

<!--- Please list dependencies added with your change also -->

Fixes #419
  • Loading branch information
hellozee authored Jan 4, 2021
1 parent bcd48cd commit 14c8c9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type Event struct {
Count int32
Action string
Skip bool `json:",omitempty"`
Resource string

Recommendations []string
Warnings []string
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion pkg/filterengine/filters/namespace_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14c8c9d

Please sign in to comment.