1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 01:16:55 +00:00
kyverno/examples/demo/qos/policy_qos.yaml
2019-06-24 10:42:38 -07:00

40 lines
No EOL
1,011 B
YAML

apiVersion : kyverno.io/v1alpha1
kind: Policy
metadata:
name: policy-qos
spec:
rules:
- name: add-memory-limit
resource:
kinds:
- Deployment
mutate:
overlay:
spec:
template:
spec:
containers:
# the wildcard * will match all containers in the list
- (name): "*"
resources:
limits:
# add memory limit if it is not exist
"+(memory)": "300Mi"
- name: check-cpu-memory-limits
resource:
kinds:
- Deployment
validate:
message: "Resource limits are required for CPU and memory"
pattern:
spec:
template:
spec:
containers:
# match all contianers
- (name): "*"
resources:
limits:
# cpu and memory are required
memory: "?*"
cpu: "?*"