1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
kyverno/test/policy/validate/check_cpu_memory.yaml
2019-11-13 13:56:20 -08:00

40 lines
855 B
YAML

apiVersion : kyverno.io/v1
kind: ClusterPolicy
metadata:
name: check-cpu-memory
spec:
rules:
- name: check-defined
match:
resources:
kinds:
- Deployment
validate:
message: "Resource limits are required for CPU and memory"
pattern:
spec:
template:
spec:
containers:
- name: "?*"
resources:
limits:
memory: "?*"
cpu: "?*"
- name: check-cpu
match:
resources:
kinds:
- Deployment
validate:
message: "CPU request should be less than 4"
pattern:
spec:
template:
spec:
containers:
- name: "*"
resources:
requests:
cpu: "<4m"