mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
2140a0239b
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com>
69 lines
1.5 KiB
YAML
69 lines
1.5 KiB
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: disallow-latest-tag
|
|
spec:
|
|
rules:
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
name: require-image-tag
|
|
validate:
|
|
failureAction: Audit
|
|
message: An image tag is required.
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- image: '*:*'
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
name: validate-image-tag
|
|
validate:
|
|
failureAction: Audit
|
|
message: Using a mutable image tag e.g. 'latest' is not allowed.
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- image: '!*:latest'
|
|
status:
|
|
conditions:
|
|
- reason: Succeeded
|
|
status: "True"
|
|
type: Ready
|
|
autogen:
|
|
rules:
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Deployment
|
|
name: autogen-require-image-tag
|
|
validate:
|
|
failureAction: Audit
|
|
message: An image tag is required.
|
|
pattern:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- image: '*:*'
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Deployment
|
|
name: autogen-validate-image-tag
|
|
validate:
|
|
failureAction: Audit
|
|
message: Using a mutable image tag e.g. 'latest' is not allowed.
|
|
pattern:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- image: '!*:latest'
|