Skip to content

Commit 1c7c847

Browse files
Luis Rodríguezclaude
andcommitted
fix: Validate InvolvedObject name before API call
Fixes #10 - Add validation to check if reference.Name is empty before attempting Kubernetes API call in GetObjectMetadata - Return empty ObjectMetadata{} without error when name is empty - Prevents "name is required" errors from flooding logs - Allows events with empty InvolvedObject names to be processed normally without metadata enrichment 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c535be4 commit 1c7c847

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/kube/objects.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func (o *ObjectMetadataCache) GetObjectMetadata(reference *v1.ObjectReference, c
5757
}
5858
}
5959

60+
// If name is empty, we cannot fetch metadata from API
61+
if reference.Name == "" {
62+
return ObjectMetadata{}, nil
63+
}
64+
6065
var group, version string
6166
s := strings.Split(reference.APIVersion, "/")
6267
if len(s) == 1 {

0 commit comments

Comments
 (0)