1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-25 17:13:48 +00:00
kyverno/test/conformance/chainsaw/validating-policies/context/imagereference/policy.yaml
Vishal Choudhary d56e6037a4
fix: image parse func and add chainsaw tests (#12396)
* fix: image parse func and add chainsaw tests

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: linter

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2025-03-13 07:01:40 +00:00

20 lines
606 B
YAML

apiVersion: policies.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
name: check-images
spec:
matchConstraints:
resourceRules:
- apiGroups: [apps]
apiVersions: [v1]
operations: [CREATE, UPDATE]
resources: [deployments]
variables:
- name: images
expression: >-
object.spec.template.spec.containers.map(e, image(e.image))
validations:
- expression: >-
variables.images.map(i, i.registry() == "ghcr.io" && !i.containsDigest()).all(e, e)
message: >-
Deployment must be have images from ghcr and images should be tagged