Closed washswat-west closed 2 days ago
Hi @washswat-west,
Thanks a lot for reporting this issue! I've already created a PR to address that bug.
However, you can already apply a workaround with version v1.13.0, which you are currently using. You just need to define the top-level event type:
sources:
'k8s-hpa-events':
displayName: "HPA Scaling Events"
botkube/kubernetes:
context: &default-plugin-context
rbac:
group:
type: Static
prefix: ""
static:
values: ["botkube-plugins-default"]
enabled: true
config:
namespaces:
include:
- ".*"
event:
types: # <------ in v1.13.0 this is required and will cause a panic if not set
- create
- delete
- update
- error
resources:
- type: autoscaling/v2/horizontalpodautoscalers
event:
types:
- create
- delete
- error
- update
reason:
include:
- "SuccessfulRescale"
Description
The botkube/kubernetes plugin encounters repeated memory access errors, specifically segmentation faults and nil pointer dereference issues, when configured with certain sources such as k8s-hpa-events. The issue consistently arises when attempting to monitor the autoscaling/v2 API group for horizontalpodautoscalers events related to HPA scaling. This results in the plugin crashing, and although the Plugin Health Monitor attempts to restart it several times, the plugin ultimately becomes deactivated.
I’m using BotKube v1.13.0, and the issue seems to occur during the plugin’s interaction with the Kubernetes API for these particular resources.
Expected behavior
With the k8s-hpa-events source enabled, BotKube should monitor horizontalpodautoscalers resources and successfully capture SuccessfulRescale events without crashing. These events should then be forwarded as notifications to Slack.
Actual behavior
When the k8s-hpa-events source is enabled, the following issues occur:
Steps to reproduce
Relevant logs:
BotKube version: v1.13.0