1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-28 18:38:40 +00:00
kyverno/test/conformance/chainsaw/validating-policies/context/imagereference/policy.yaml

21 lines
606 B
YAML
Raw Normal View History

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