1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-14 11:57:32 +00:00

Add APIVersion to Result APIs

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
This commit is contained in:
Frank Jogeleit 2022-03-27 13:34:13 +02:00
parent 6109d62c97
commit a8f9752e9e
5 changed files with 12 additions and 7 deletions

View file

@ -1,5 +1,9 @@
# Changelog
# 2.7.1
* Policy Reporter
* Add Resource APIVersion to the Results REST APIs
# 2.7.0
* Policy Reporter
* PolicyReport Filter:

View file

@ -5,8 +5,8 @@ description: |
It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
type: application
version: 2.7.0
appVersion: 2.4.0
version: 2.7.1
appVersion: 2.4.1
icon: https://github.com/kyverno/kyverno/raw/main/img/logo.png
home: https://kyverno.github.io/policy-reporter

View file

@ -2,7 +2,7 @@ image:
registry: ghcr.io
repository: kyverno/policy-reporter
pullPolicy: IfNotPresent
tag: 2.4.0
tag: 2.4.1
imagePullSecrets: []

View file

@ -29,6 +29,7 @@ type ListResult struct {
ID string `json:"id"`
Namespace string `json:"namespace,omitempty"`
Kind string `json:"kind"`
APIVersion string `json:"apiVersion"`
Name string `json:"name"`
Message string `json:"message"`
Category string `json:"category,omitempty"`

View file

@ -607,7 +607,7 @@ func (s *policyReportStore) FetchNamespacedResults(filter api.Filter) ([]*api.Li
}
rows, err := s.db.Query(`
SELECT id, resource_namespace, resource_kind, resource_name, message, policy, rule, severity, properties, status, category
SELECT id, resource_namespace, resource_kind, resource_api_version, resource_name, message, policy, rule, severity, properties, status, category
FROM policy_report_result WHERE resource_namespace != ""`+where+`
ORDER BY resource_namespace, resource_name, resource_uid ASC`, args...)
@ -619,7 +619,7 @@ func (s *policyReportStore) FetchNamespacedResults(filter api.Filter) ([]*api.Li
result := api.ListResult{}
var props []byte
err := rows.Scan(&result.ID, &result.Namespace, &result.Kind, &result.Name, &result.Message, &result.Policy, &result.Rule, &result.Severity, &props, &result.Status, &result.Category)
err := rows.Scan(&result.ID, &result.Namespace, &result.Kind, &result.APIVersion, &result.Name, &result.Message, &result.Policy, &result.Rule, &result.Severity, &props, &result.Status, &result.Category)
if err != nil {
return list, err
}
@ -641,7 +641,7 @@ func (s *policyReportStore) FetchClusterResults(filter api.Filter) ([]*api.ListR
}
rows, err := s.db.Query(`
SELECT id, resource_namespace, resource_kind, resource_name, message, policy, rule, severity, properties, status, category
SELECT id, resource_namespace, resource_kind, resource_api_version, resource_name, message, policy, rule, severity, properties, status, category
FROM policy_report_result WHERE resource_namespace =""`+where+`
ORDER BY resource_namespace, resource_name, resource_uid ASC`, args...)
@ -653,7 +653,7 @@ func (s *policyReportStore) FetchClusterResults(filter api.Filter) ([]*api.ListR
result := api.ListResult{}
var props []byte
err := rows.Scan(&result.ID, &result.Namespace, &result.Kind, &result.Name, &result.Message, &result.Policy, &result.Rule, &result.Severity, &props, &result.Status, &result.Category)
err := rows.Scan(&result.ID, &result.Namespace, &result.Kind, &result.APIVersion, &result.Name, &result.Message, &result.Policy, &result.Rule, &result.Severity, &props, &result.Status, &result.Category)
if err != nil {
return list, err
}