mirror of
https://github.com/kyverno/kyverno.git
synced 2025-01-20 18:52:16 +00:00
6a43ec4bcf
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
45 lines
949 B
YAML
45 lines
949 B
YAML
---
|
|
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: check-cpu-memory
|
|
spec:
|
|
admission: true
|
|
background: true
|
|
rules:
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Deployment
|
|
name: check-defined
|
|
validate:
|
|
message: Resource limits are required for CPU and memory
|
|
pattern:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- name: ?*
|
|
resources:
|
|
limits:
|
|
cpu: ?*
|
|
memory: ?*
|
|
- match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Deployment
|
|
name: check-cpu
|
|
validate:
|
|
message: CPU request should be less than 4
|
|
pattern:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- name: '*'
|
|
resources:
|
|
requests:
|
|
cpu: <4m
|
|
validationFailureAction: Audit
|