SV-257554r961152_rule
V-257554
SRG-APP-000246-CTR-000605
CNTR-OS-000620
CAT II
10
Configure a default resource quota to protect resource over utilization by performing the following steps:
1. Create a bootstrap project template (if not already created) by executing the following:
oc adm create-bootstrap-project-template -o yaml > template.yaml
2. Edit the template and add a ResourceQuota object definition before the parameters section.
- apiVersion: v1
kind: ResourceQuota
metadata:
name: example
spec:
hard:
persistentvolumeclaims: "10"
requests.storage: "50Gi"
...
parameters:
3. Apply the project template to the cluster by executing the following:
oc create -f template.yaml -n openshift-config
4. Set the default cluster project request template by executing the following:
oc patch project.config.openshift.io/cluster --type=merge -p '{"spec":{"projectRequestTemplate":{"name": "<PROJECT_REQUEST_TEMPLATE>"}}}'
Details regarding the configuration of resource quotas can be reviewed at https://docs.openshift.com/container-platform/4.8/applications/quotas/quotas-setting-per-project.html.
Check for Resource Quota. Verify a default project template is defined by executing the following:
oc get project.config.openshift.io/cluster -o jsonpath="{.spec.projectRequestTemplate.name}"
If no project request template is in use by the project config, this is a finding.
Verify the project template includes a default resource quota.
oc get templates/<PROJECT-REQUEST-TEMPLATE> -n openshift-config -o jsonpath="{.objects[?(.kind=='ResourceQuota')]}{'\n'}"
Replace <PROJECT-REQUEST-TEMPLATE> with the name of the project request template returned from the earlier query.
If the project template is not defined, or there are no ResourceQuota definitions in it, this is a finding.
V-257554
False
CNTR-OS-000620
Check for Resource Quota. Verify a default project template is defined by executing the following:
oc get project.config.openshift.io/cluster -o jsonpath="{.spec.projectRequestTemplate.name}"
If no project request template is in use by the project config, this is a finding.
Verify the project template includes a default resource quota.
oc get templates/<PROJECT-REQUEST-TEMPLATE> -n openshift-config -o jsonpath="{.objects[?(.kind=='ResourceQuota')]}{'\n'}"
Replace <PROJECT-REQUEST-TEMPLATE> with the name of the project request template returned from the earlier query.
If the project template is not defined, or there are no ResourceQuota definitions in it, this is a finding.
M
5547