mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
40 lines
855 B
YAML
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"
|