2019-11-13 13:56:20 -08:00
|
|
|
apiVersion : kyverno.io/v1
|
2019-10-10 10:29:10 -07:00
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
2019-11-10 18:13:01 -08:00
|
|
|
name: restrict-image-registries
|
2019-10-11 18:57:16 -07:00
|
|
|
annotations:
|
2019-11-11 18:21:16 -08:00
|
|
|
policies.kyverno.io/category: Workload Management
|
2019-10-14 16:33:19 -07:00
|
|
|
policies.kyverno.io/description: Images from unknown registries may not be scanned and secured.
|
2019-11-10 18:13:01 -08:00
|
|
|
Requiring use of known registries helps reduce threat exposure.
|
2019-10-10 10:29:10 -07:00
|
|
|
spec:
|
|
|
|
rules:
|
2019-11-10 18:13:01 -08:00
|
|
|
- name: validate-registries
|
2019-10-10 10:29:10 -07:00
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Pod
|
|
|
|
validate:
|
2019-11-10 18:13:01 -08:00
|
|
|
message: "Unknown image registry"
|
2019-10-10 10:29:10 -07:00
|
|
|
pattern:
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- image: "k8s.gcr.io/* | gcr.io/*"
|