mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
39 lines
924 B
YAML
39 lines
924 B
YAML
apiVersion : kyverno.io/v1
|
|
kind : ClusterPolicy
|
|
metadata :
|
|
name : policy-deployment
|
|
spec :
|
|
rules:
|
|
- name: add-label
|
|
match:
|
|
resources:
|
|
kinds :
|
|
- Deployment
|
|
selector :
|
|
matchLabels :
|
|
cli: test
|
|
mutate:
|
|
patches:
|
|
- path: /metadata/labels/isMutated
|
|
op: add
|
|
value: "true"
|
|
- path: /metadata/labels/app
|
|
op: replace
|
|
value: "nginx_is_mutated"
|
|
- name: check-image
|
|
match:
|
|
resources:
|
|
kinds :
|
|
- Deployment
|
|
selector :
|
|
matchLabels :
|
|
cli: test
|
|
validate:
|
|
message: "The imagePullPolicy must be Always when using image nginx"
|
|
pattern:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- (image): "nginx*"
|
|
imagePullPolicy: Always
|