1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/test/best_practices/require_pod_requests_limits.yaml
Charles-Edouard Brétéché 7562bea6db
chore: apply policy fixes (#8427)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-17 22:24:26 +00:00

34 lines
1 KiB
YAML

---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
annotations:
policies.kyverno.io/category: Workload Management
policies.kyverno.io/description: As application workloads share cluster resources,
it is important to limit resources requested and consumed by each pod. It is
recommended to require 'resources.requests' and 'resources.limits.memory' per
pod. If a namespace level request or limit is specified, defaults will automatically
be applied to each pod based on the 'LimitRange' configuration.
name: require-pod-requests-limits
spec:
admission: true
background: true
rules:
- match:
any:
- resources:
kinds:
- Pod
name: validate-resources
validate:
message: CPU and memory resource requests and limits are required
pattern:
spec:
containers:
- resources:
limits:
memory: ?*
requests:
cpu: ?*
memory: ?*
validationFailureAction: Audit