Skip to content

Commit a4e44d5

Browse files
feat: add event failure handling in service analyzer (#1132)
Signed-off-by: magicsong <[email protected]> Co-authored-by: magicsong <[email protected]> Co-authored-by: Alex Jones <[email protected]>
1 parent 24ebeaf commit a4e44d5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pkg/analyzer/service.go

+16-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,22 @@ func (ServiceAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
111111
})
112112
}
113113
}
114-
114+
// fetch event
115+
events, err := a.Client.GetClient().CoreV1().Events(a.Namespace).List(a.Context,
116+
metav1.ListOptions{
117+
FieldSelector: "involvedObject.name=" + ep.Name,
118+
})
119+
120+
if err != nil {
121+
return nil, err
122+
}
123+
for _, event := range events.Items {
124+
if event.Type != "Normal" {
125+
failures = append(failures, common.Failure{
126+
Text: fmt.Sprintf("Service %s/%s has event %s", ep.Namespace, ep.Name, event.Message),
127+
})
128+
}
129+
}
115130
if len(failures) > 0 {
116131
preAnalysis[fmt.Sprintf("%s/%s", ep.Namespace, ep.Name)] = common.PreAnalysis{
117132
Endpoint: ep,

0 commit comments

Comments
 (0)