Use of a SHA checksum when pulling an image is often preferable because tags are mutable and can be overwritten. This policy checks to ensure that all images use SHA checksums rather than tags.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-image-checksumannotations:policies.kyverno.io/title: Require Images Use Checksumspolicies.kyverno.io/category: Samplepolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/description: Use of a SHA checksum when pulling an image is often preferable because tags are mutable and can be overwritten. This policy checks to ensure that all images use SHA checksums rather than tags.spec:validationFailureAction: Auditbackground: truerules:- name: require-image-checksummatch:any:- resources:kinds:- Podvalidate:message: Images must use checksums rather than tags.pattern:spec:containers:- image: "*@*""=(ephemeralContainers)":- image: "*@*""=(initContainers)":- image: "*@*"
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.