Skip to content

Commit

Permalink
feat: add event failure handling in service analyzer (#1132)
Browse files Browse the repository at this point in the history
Signed-off-by: magicsong <[email protected]>

Co-authored-by: magicsong <[email protected]>
Co-authored-by: Alex Jones <[email protected]>
Signed-off-by: AlexsJones <[email protected]>
  • Loading branch information
3 people committed Oct 24, 2024
1 parent 8678ced commit 7919d35
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/analyzer/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,22 @@ func (ServiceAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
})
}
}

// fetch event
events, err := a.Client.GetClient().CoreV1().Events(a.Namespace).List(a.Context,
metav1.ListOptions{
FieldSelector: "involvedObject.name=" + ep.Name,
})

if err != nil {
return nil, err
}
for _, event := range events.Items {
if event.Type != "Normal" {
failures = append(failures, common.Failure{
Text: fmt.Sprintf("Service %s/%s has event %s", ep.Namespace, ep.Name, event.Message),
})
}
}
if len(failures) > 0 {
preAnalysis[fmt.Sprintf("%s/%s", ep.Namespace, ep.Name)] = common.PreAnalysis{
Endpoint: ep,
Expand Down

0 comments on commit 7919d35

Please sign in to comment.