2019-05-22 17:29:26 -07:00
|
|
|
apiVersion : kyverno.io/v1alpha1
|
2019-05-17 14:18:10 -07:00
|
|
|
kind: Policy
|
|
|
|
metadata:
|
2019-05-21 00:46:37 -07:00
|
|
|
name: image-pull-policy
|
2019-05-17 14:18:10 -07:00
|
|
|
spec:
|
|
|
|
rules:
|
2019-05-21 00:46:37 -07:00
|
|
|
- name: image-pull-policy
|
2019-05-17 14:18:10 -07:00
|
|
|
resource:
|
2019-05-23 20:37:11 +03:00
|
|
|
kinds:
|
2019-05-21 15:43:43 -07:00
|
|
|
- Deployment
|
2019-05-23 20:37:11 +03:00
|
|
|
validate:
|
|
|
|
message: "Image tag ':latest' requires imagePullPolicy 'Always'"
|
|
|
|
pattern:
|
2019-05-21 00:46:37 -07:00
|
|
|
spec:
|
2019-05-23 20:37:11 +03:00
|
|
|
template:
|
|
|
|
spec:
|
|
|
|
containers:
|
2019-05-23 20:42:34 -07:00
|
|
|
# select images which end with :latest
|
|
|
|
- (image): "*latest"
|
|
|
|
# require that the imagePullPolicy is "Always"
|
|
|
|
imagePullPolicy: Always
|