1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-28 02:18:15 +00:00

fix: background image verification not working (#7564)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-06-16 16:48:59 +02:00 committed by GitHub
parent 43685aedc2
commit 7ba136767a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,6 +85,12 @@ func (s *scanner) validateResource(ctx context.Context, resource unstructured.Un
}
func (s *scanner) validateImages(ctx context.Context, resource unstructured.Unstructured, nsLabels map[string]string, policy kyvernov1.PolicyInterface) (*engineapi.EngineResponse, error) {
annotations := resource.GetAnnotations()
if annotations != nil {
resource = *resource.DeepCopy()
delete(annotations, "kyverno.io/verify-images")
resource.SetAnnotations(annotations)
}
policyCtx, err := engine.NewPolicyContext(s.jp, resource, kyvernov1.Create, nil, s.config)
if err != nil {
return nil, err