mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
28 lines
817 B
YAML
28 lines
817 B
YAML
|
apiVersion: kyverno.io/v1alpha1
|
||
|
kind: Policy
|
||
|
metadata:
|
||
|
name: check-resources
|
||
|
spec:
|
||
|
validationFailureAction: "audit"
|
||
|
rules:
|
||
|
- name: check-pod-resources
|
||
|
match:
|
||
|
resources:
|
||
|
kinds:
|
||
|
- Pod
|
||
|
validate:
|
||
|
message: "CPU and memory resource requests and limits are required"
|
||
|
pattern:
|
||
|
spec:
|
||
|
containers:
|
||
|
# 'name: *' selects all containers in the pod
|
||
|
- name: "*"
|
||
|
resources:
|
||
|
requests:
|
||
|
# '?' requires 1 alphanumeric character and '*' means that there can be 0 or more characters.
|
||
|
# Using them together e.g. '?*' requires at least one character.
|
||
|
memory: "?*"
|
||
|
cpu: "?*"
|
||
|
limits:
|
||
|
memory: "?*"
|
||
|
cpu: "?*"
|