1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 01:16:55 +00:00
kyverno/test/conformance/kuttl/exceptions/events-creation/policy.yaml
shuting efe09b286e
fix source in events (#6739)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-31 07:34:31 +02:00

29 lines
No EOL
958 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-latest-tag-events-creation
annotations:
policies.kyverno.io/title: Disallow Latest Tag
policies.kyverno.io/category: Best Practices
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Pod
policies.kyverno.io/description: >-
The ':latest' tag is mutable and can lead to unexpected errors if the
image changes. A best practice is to use an immutable tag that maps to
a specific version of an application Pod. This policy validates that the image
specifies a tag and that it is not called `latest`.
spec:
validationFailureAction: enforce
background: true
rules:
- name: validate-image-tag
match:
resources:
kinds:
- Pod
validate:
message: "An image tag is required (:latest is not allowed)"
pattern:
spec:
containers:
- image: "!*:latest & *:*"