1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 23:46:56 +00:00
kyverno/test/best_practices/require_pod_requests_limits.yaml

35 lines
1 KiB
YAML
Raw Normal View History

---
2019-11-13 13:56:20 -08:00
apiVersion: kyverno.io/v1
2019-10-14 10:47:54 -07:00
kind: ClusterPolicy
2019-10-09 17:37:31 -07:00
metadata:
2019-10-11 18:57:16 -07:00
annotations:
2019-11-11 18:21:16 -08:00
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
2019-10-09 17:37:31 -07:00
spec:
admission: true
background: true
2019-10-09 17:37:31 -07:00
rules:
- match:
any:
- resources:
kinds:
- Pod
name: validate-resources
2019-10-09 17:37:31 -07:00
validate:
message: CPU and memory resource requests and limits are required
2019-10-09 17:37:31 -07:00
pattern:
spec:
containers:
- resources:
limits:
memory: ?*
requests:
cpu: ?*
memory: ?*
validationFailureAction: Audit