1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 00:17:13 +00:00
kyverno/examples/cli/policy_deployment.yaml

38 lines
871 B
YAML
Raw Normal View History

2019-05-21 18:38:52 -07:00
apiVersion : kyverno.io/v1alpha1
kind : Policy
metadata :
name : policy-deployment
spec :
rules:
- name: add-label
resource:
2019-05-21 15:49:48 -07:00
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
resource:
kinds :
- Deployment
selector :
matchLabels :
cli: test
validate:
2019-05-31 16:57:39 -07:00
message: "The imagePullPolicy must be Always when using image nginx"
pattern:
spec:
template:
spec:
containers:
2019-05-31 16:57:39 -07:00
- (image): "nginx*"
imagePullPolicy: Always