mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
fix: panic in background reports (#7332)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
7a838de4f1
commit
8ecf829647
2 changed files with 6 additions and 6 deletions
|
@ -309,9 +309,9 @@ func (c *controller) reconcileReport(
|
|||
for _, result := range scanner.ScanResource(ctx, *target, nsLabels, policy) {
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
} else {
|
||||
ruleResults = append(ruleResults, reportutils.EngineResponseToReportResults(result.EngineResponse)...)
|
||||
utils.GenerateEvents(logger, c.eventGen, c.config, result.EngineResponse)
|
||||
} else if result.EngineResponse != nil {
|
||||
ruleResults = append(ruleResults, reportutils.EngineResponseToReportResults(*result.EngineResponse)...)
|
||||
utils.GenerateEvents(logger, c.eventGen, c.config, *result.EngineResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ type scanner struct {
|
|||
}
|
||||
|
||||
type ScanResult struct {
|
||||
EngineResponse engineapi.EngineResponse
|
||||
EngineResponse *engineapi.EngineResponse
|
||||
Error error
|
||||
}
|
||||
|
||||
|
@ -61,11 +61,11 @@ func (s *scanner) ScanResource(ctx context.Context, resource unstructured.Unstru
|
|||
}
|
||||
if response == nil {
|
||||
response = ivResponse
|
||||
} else {
|
||||
} else if ivResponse != nil {
|
||||
response.PolicyResponse.Rules = append(response.PolicyResponse.Rules, ivResponse.PolicyResponse.Rules...)
|
||||
}
|
||||
}
|
||||
results[policy] = ScanResult{*response, multierr.Combine(errors...)}
|
||||
results[policy] = ScanResult{response, multierr.Combine(errors...)}
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue