Skip to content

Commit 59958c1

Browse files
authored
Merge pull request #22891 from sjhala-ccs/cnv-4721-cdi-namespace-resourcequota
CNV-4721 Make CDI work with namespace resource quota
2 parents 482774f + 3a1c727 commit 59958c1

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,8 @@ Topics:
15881588
Topics:
15891589
- Name: Configuring local storage for virtual machines
15901590
File: virt-configuring-local-storage-for-vms
1591+
- Name: Configuring CDI to work with namespaces that have a compute resource quota
1592+
File: virt-configuring-cdi-for-namespace-resourcequota
15911593
- Name: Uploading local disk images by using the virtctl tool
15921594
File: virt-uploading-local-disk-images-virtctl
15931595
- Name: Uploading a local disk image to a block storage DataVolume
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virtual_disks/virt-configuring-cdi-for-namespace-resourcequota.adoc
4+
5+
[id="virt-about-cpu-and-memory-quota-namespace_{context}"]
6+
= About CPU and memory quotas in a namespace
7+
8+
A _resource quota_, defined by the `ResourceQuota` object, imposes restrictions on
9+
a namespace that limit the total amount of compute resources that can be
10+
consumed by resources within that namespace.
11+
12+
The `CDIConfig` object defines the user configuration for the Containerized Data Importer (CDI). The CPU and
13+
memory request and limit values for the `CDIConfig` object are set to a default
14+
value of 0.
15+
This ensures that Pods created by CDI that make no compute resource requirements
16+
are given the default values and are allowed to run in a namespace that is restricted
17+
with a quota.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virtual_disks/virt-configuring-cdi-for-namespace-resourcequota.adoc
4+
5+
[id="virt-editing-cdi-cpu-and-memory-defaults_{context}"]
6+
= Editing the `CDIConfig` object to override CPU and memory defaults
7+
8+
Modify the default settings for CPU and memory requests and limits for your
9+
use case by editing the `spec` attribute of the `CDIConfig` object.
10+
11+
.Prerequisites
12+
13+
* Install the OpenShift Command-line Interface (CLI), commonly known as `oc`.
14+
15+
.Procedure
16+
17+
. Edit the `cdiconfig/config` by running the following command:
18+
+
19+
----
20+
$ oc edit cdiconfig/config
21+
----
22+
23+
. Change the default CPU and memory requests and limits by editing the `spec: podResourceRequirements` property of the `CDIConfig` object:
24+
+
25+
[source,yaml]
26+
27+
----
28+
apiVersion: cdi.kubevirt.io/v1alpha1
29+
kind: CDIConfig
30+
metadata:
31+
labels:
32+
app: containerized-data-importer
33+
cdi.kubevirt.io: ""
34+
name: config
35+
spec:
36+
podResourceRequirements:
37+
limits:
38+
cpu: "4"
39+
memory: "1Gi"
40+
requests:
41+
cpu: "1"
42+
memory: "250Mi"
43+
...
44+
----
45+
46+
. Save and exit the editor to update the `CDIConfig` object.
47+
48+
.Verification Step
49+
50+
View the `CDIConfig` status and verify your changes by running the following command:
51+
52+
----
53+
$ oc get cdiconfig config -o yaml
54+
----
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[id="virt-configuring-cdi-for-namespace-resourcequota"]
2+
= Configuring CDI to work with namespaces that have a compute resource quota
3+
include::modules/virt-document-attributes.adoc[]
4+
:context: virt-configuring-cdi-for-namespace-resourcequota
5+
toc::[]
6+
7+
You can use the Containerized Data Importer (CDI) to import, upload, and clone virtual machine disks into namespaces that are subject to CPU and memory resource restrictions.
8+
9+
include::modules/virt-about-cpu-and-memory-quota-namespace.adoc[leveloffset=+1]
10+
11+
include::modules/virt-editing-cdi-cpu-and-memory-defaults.adoc[leveloffset=+1]
12+
13+
== Additional resources
14+
15+
* xref:../../../applications/quotas/quotas-setting-per-project.adoc#quotas-setting-per-project[Resource quotas per project]

0 commit comments

Comments
 (0)