mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-09 17:37:12 +00:00
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com>
31 lines
985 B
YAML
31 lines
985 B
YAML
---
|
|
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
annotations:
|
|
policies.kyverno.io/category: Best Practices
|
|
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`. '
|
|
policies.kyverno.io/severity: medium
|
|
policies.kyverno.io/subject: Pod
|
|
policies.kyverno.io/title: Disallow Latest Tag
|
|
name: disallow-latest-tag-events-creation
|
|
spec:
|
|
admission: true
|
|
background: true
|
|
rules:
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
name: validate-image-tag
|
|
validate:
|
|
failureAction: Enforce
|
|
message: An image tag is required (:latest is not allowed)
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- image: '!*:latest & *:*'
|