Skip to content

Commit

Permalink
fix chart api
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
  • Loading branch information
fjogeleit committed Aug 22, 2024
1 parent f02df64 commit 470ea67
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
19 changes: 18 additions & 1 deletion charts/policy-reporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,31 @@ ui:
sources:
# -- kyverno specific UI confiurations
- name: kyverno
# -- show results per category, other option: severity
chartType: result
# -- enabled action button to generate PolicyExceptions from the UI
exceptions: false
# -- exclude Pod, Job and Replica resources from kyverno results by default if no kinds are specified
# -- exclude results or (cluster)kinds per source
excludes:
results:
- warn
- error

- name: Trivy ConfigAudit
chartType: severity
excludes:
results:
- pass
- error

- name: Trivy Vulnerability
chartType: severity
excludes:
results:
- pass
- error


# -- Connected Policy Reporter APIs
clusters:
- name: Default
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/v2/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ func TestV2(t *testing.T) {

json.NewDecoder(w.Body).Decode(&resp)

assert.Contains(t, resp, v2.SourceDetails{Name: "Kyverno", Categories: []*v2.Category{{Name: "test", Status: &v2.StatusList{Pass: 1, Warn: 1, Fail: 1}, Severities: &v2.SeverityList{}}}})
assert.Contains(t, resp, v2.SourceDetails{Name: "test", Categories: []*v2.Category{{Name: "Other", Status: &v2.StatusList{Fail: 1}, Severities: &v2.SeverityList{}}, {Name: "test", Status: &v2.StatusList{Fail: 2}, Severities: &v2.SeverityList{}}}})
assert.Contains(t, resp, v2.SourceDetails{Name: "Kyverno", Categories: []*v2.Category{{Name: "test", Status: &v2.StatusList{Pass: 1, Warn: 1, Fail: 1}, Severities: &v2.SeverityList{High: 3}}}})
assert.Contains(t, resp, v2.SourceDetails{Name: "test", Categories: []*v2.Category{{Name: "Other", Status: &v2.StatusList{Fail: 1}, Severities: &v2.SeverityList{Unknown: 1}}, {Name: "test", Status: &v2.StatusList{Fail: 2}, Severities: &v2.SeverityList{High: 2}}}})
}
})

Expand Down
4 changes: 2 additions & 2 deletions pkg/api/v2/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ func MapToSourceDetails(categories []db.Category) []*SourceDetails {

list[r.Source] = &SourceDetails{
Name: r.Source,
Categories: []*Category{MapResultToCategory(r, &Category{
Categories: []*Category{{
Name: helper.Defaults(r.Name, "Other"),
Status: &StatusList{},
Severities: &SeverityList{},
})},
}},
}

UpdateCategory(r, list[r.Source])
Expand Down

0 comments on commit 470ea67

Please sign in to comment.