mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
7562bea6db
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
34 lines
1 KiB
YAML
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
|