2019-11-13 21:56:20 +00:00
|
|
|
apiVersion: kyverno.io/v1
|
2019-10-10 17:46:11 +00:00
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
2019-11-11 04:58:57 +00:00
|
|
|
name: add-ns-quota
|
2019-10-12 01:57:16 +00:00
|
|
|
annotations:
|
2019-11-12 02:21:16 +00:00
|
|
|
policies.kyverno.io/category: Workload Isolation
|
2019-10-14 23:33:19 +00:00
|
|
|
policies.kyverno.io/description: To limit the number of objects, as well as the
|
2019-11-11 04:58:57 +00:00
|
|
|
total amount of compute that may be consumed by a single namespace, create
|
|
|
|
a default resource quota for each namespace.
|
2019-10-10 17:46:11 +00:00
|
|
|
spec:
|
|
|
|
rules:
|
2019-11-11 04:58:57 +00:00
|
|
|
- name: generate-resourcequota
|
2019-10-10 17:46:11 +00:00
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Namespace
|
2020-08-31 18:25:13 +00:00
|
|
|
exclude:
|
2020-11-11 20:55:02 +00:00
|
|
|
resources:
|
|
|
|
namespaces:
|
|
|
|
- "kube-system"
|
|
|
|
- "default"
|
|
|
|
- "kube-public"
|
|
|
|
- "kyverno"
|
2019-10-10 17:46:11 +00:00
|
|
|
generate:
|
|
|
|
kind: ResourceQuota
|
2019-12-10 17:51:15 +00:00
|
|
|
name: default-resourcequota
|
2020-07-13 20:42:11 +00:00
|
|
|
synchronize : true
|
2020-01-07 23:13:57 +00:00
|
|
|
namespace: "{{request.object.metadata.name}}"
|
2019-10-24 17:37:52 +00:00
|
|
|
data:
|
|
|
|
spec:
|
|
|
|
hard:
|
2019-11-13 00:37:40 +00:00
|
|
|
requests.cpu: '4'
|
|
|
|
requests.memory: '16Gi'
|
|
|
|
limits.cpu: '4'
|
|
|
|
limits.memory: '16Gi'
|
2019-11-16 02:32:24 +00:00
|
|
|
- name: generate-limitrange
|
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Namespace
|
|
|
|
generate:
|
|
|
|
kind: LimitRange
|
2019-12-10 17:51:15 +00:00
|
|
|
name: default-limitrange
|
2020-07-13 20:42:11 +00:00
|
|
|
synchronize : true
|
2020-01-07 23:13:57 +00:00
|
|
|
namespace: "{{request.object.metadata.name}}"
|
2019-11-16 02:32:24 +00:00
|
|
|
data:
|
|
|
|
spec:
|
|
|
|
limits:
|
|
|
|
- default:
|
|
|
|
cpu: 500m
|
|
|
|
memory: 1Gi
|
|
|
|
defaultRequest:
|
|
|
|
cpu: 200m
|
|
|
|
memory: 256Mi
|
|
|
|
type: Container
|