Skip to content

Commit

Permalink
fix: ignore events whose involved object's UID is not a UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jun 21, 2024
1 parent 74298e6 commit 81c67ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scrapers/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/flanksource/commons/collections"
"github.com/flanksource/duty/context"
"github.com/flanksource/duty/models"
"github.com/google/uuid"
"github.com/samber/lo"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/dynamic"
Expand Down Expand Up @@ -288,6 +289,11 @@ func ExtractResults(ctx api.ScrapeContext, config v1.Kubernetes, objs []*unstruc
continue
}

if _, err := uuid.Parse(string(event.InvolvedObject.UID)); err != nil {
ctx.Logger.V(3).Infof("skipping event (reason=%s, message=%s) because the involved object ID is not a valid UUID: %s", event.Reason, event.Message, event.InvolvedObject.UID)
continue
}

if config.Event.Exclusions.Filter(event) {
ctx.Logger.V(4).Infof("excluding event object %s/%s/%s: %s",
event.InvolvedObject.Namespace, event.InvolvedObject.Name,
Expand Down

0 comments on commit 81c67ae

Please sign in to comment.