Open danieltaub opened 6 months ago
After looking in the code it seems minCount
will work only within match rule, and not drop rule, maybe it's worth do add some docs on minCount
conf
There is a test for Rule of minCount, but not via a Route For example, this test will fail becuase the event will proceed
func TestRouteCount(t *testing.T) {
ev1 := kube.EnhancedEvent{}
ev1.Type = "Warning"
ev1.Count = 1
ev1.Namespace = "server"
reg := testReceiverRegistry{}
r := Route{
Drop: []Rule{{
MinCount: 3,
Type: "Normal",
}},
Match: []Rule{{
Namespace: "server",
Receiver: "elastic",
}},
}
r.ProcessEvent(&ev1, ®)
assert.False(t, reg.isEventRcvd("elastic", &ev1))
}
But if the minCount
will move to the Match section it will work and drop the event
func TestRouteCount(t *testing.T) {
ev1 := kube.EnhancedEvent{}
ev1.Type = "Warning"
ev1.Count = 1
ev1.Namespace = "server"
reg := testReceiverRegistry{}
r := Route{
Drop: []Rule{{
Type: "Normal",
}},
Match: []Rule{{
MinCount: 3,
Namespace: "server",
Receiver: "elastic",
}},
}
r.ProcessEvent(&ev1, ®)
assert.False(t, reg.isEventRcvd("elastic", &ev1))
}
I am encountering an issue with the
minCount
configuration in kubernetes-event-exporter, where it doesn't seem to be working as expected. Despite settingminCount
to 3, I am receiving notifications for events with a count of 1. Interestingly, after cloning the repository and examining theminCount
tests, everything seems to be in order, which makes this behavior quite puzzling. This issue does happens in the opposite side sometimes where count of the event greater them min count and we not receiving any alert/logs in the pod.Configuration:
Here is the relevant part of my configuration:
Issue:
The configuration should theoretically prevent PagerDuty alerts for events with a count less than 3. However, I am still receiving alerts for events with a count of 1.
Example:
An example of an alert received, which is visible in the stdout of the exporter pod, is as follows (with sensitive information replaced):
As seen in the above JSON, the event count is 1, which should not trigger an alert based on my configuration.
Any assistance in resolving this issue would be greatly appreciated. Thank you for your time and help.