[Bug] image variable isn't registered while compiling matchImageReferences in ImageValidatingPolicy
Author: frgt10csCreated Aug 31, 2026Updated Sep 18, 2026
Labelsbugtriage
Kyverno Version
1.18.0
Kubernetes Version
1.33.x
Kubernetes Platform
Minikube
Kyverno Rule Type
verifyImages
Description
Docs describe the ability to use expression in matchImageReferences to filter images for ImageValidatingPolicy: https://release-1-18-0.kyverno.io/docs/policy-types/image-validating-policy/#matchimagereferences
But when i'm trying to apply policy with the example mentioned on the page i'm getting error undeclared reference to 'image'
We discussed that problem in slack and find out that the image variable isn't registered while compiling matchImageReferences: https://kubernetes.slack.com/archives/CLGR9BJU9/p1787756876743729
kyverno 1.18.2 k8s 1.33.8
Steps to reproduce
- Apply ImageValidatingPolicy with
expressioninmatchImageReferencesjust like here: https://release-1-18-0.kyverno.io/docs/policy-types/image-validating-policy/#matchimagereferences - Got error
Expected behavior
Policy can be applied and filter images by the expression
Screenshots
Kyverno logs
Slack discussion
https://kubernetes.slack.com/archives/CLGR9BJU9/p1787756876743729
Troubleshooting
- I have read and followed the documentation AND the troubleshooting guide.
- I have searched other issues in this repository and mine is not recorded.
Source: kyverno/kyverno