mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-07 00:17:13 +00:00
32 lines
692 B
YAML
32 lines
692 B
YAML
|
apiVersion: kyverno.io/v1
|
||
|
kind: ClusterPolicy
|
||
|
metadata:
|
||
|
name: disallow-latest-tag
|
||
|
annotations:
|
||
|
pod-policies.kyverno.io/autogen-controllers: Deployment,StatefulSet,Job
|
||
|
spec:
|
||
|
validationFailureAction: audit
|
||
|
rules:
|
||
|
- match:
|
||
|
resources:
|
||
|
kinds:
|
||
|
- Pod
|
||
|
name: require-image-tag
|
||
|
validate:
|
||
|
message: An image tag is required.
|
||
|
pattern:
|
||
|
spec:
|
||
|
containers:
|
||
|
- image: '*:*'
|
||
|
- match:
|
||
|
resources:
|
||
|
kinds:
|
||
|
- Pod
|
||
|
name: validate-image-tag
|
||
|
validate:
|
||
|
message: Using a mutable image tag e.g. 'latest' is not allowed.
|
||
|
pattern:
|
||
|
spec:
|
||
|
containers:
|
||
|
- image: '!*:latest'
|