diff --git a/modules/virt-about-cpu-and-memory-quota-namespace.adoc b/modules/virt-about-cpu-and-memory-quota-namespace.adoc index 2f3c93e9b208..3e6b3b51ee1b 100644 --- a/modules/virt-about-cpu-and-memory-quota-namespace.adoc +++ b/modules/virt-about-cpu-and-memory-quota-namespace.adoc @@ -8,6 +8,4 @@ A _resource quota_, defined by the `ResourceQuota` object, imposes restrictions on a namespace that limit the total amount of compute resources that can be consumed by resources within that namespace. -The `HyperConverged` custom resource (CR) defines the user configuration for the Containerized Data Importer (CDI). The CPU and memory request and limit values are set to a default value of `0`. This ensures that pods created by CDI that do not specify compute resource requirements are given the default values and are allowed to run in a namespace that is restricted with a quota. - -When the `AutoResourceLimits` feature gate is enabled, {VirtProductName} automatically manages CPU and memory limits. If a namespace has both CPU and memory quotas, the memory limit is set to double the base allocation and the CPU limit is one per vCPU. \ No newline at end of file +The `HyperConverged` custom resource (CR) defines the user configuration for the Containerized Data Importer (CDI). The CPU and memory request and limit values are set to a default value of `0`. This ensures that pods created by CDI that do not specify compute resource requirements are given the default values and are allowed to run in a namespace that is restricted with a quota. \ No newline at end of file diff --git a/modules/virt-setting-resource-quota-limits-for-vms.adoc b/modules/virt-setting-resource-quota-limits-for-vms.adoc index 4f802b689735..dfca17f5c8d2 100644 --- a/modules/virt-setting-resource-quota-limits-for-vms.adoc +++ b/modules/virt-setting-resource-quota-limits-for-vms.adoc @@ -4,10 +4,57 @@ :_mod-docs-content-type: PROCEDURE [id="virt-setting-resource-quota-limits-for-vms_{context}"] -= Setting resource quota limits for virtual machines += Enabling automatic resource quota limits for virtual machines + +When the `AutoResourceLimits` feature gate is enabled, {VirtProductName} automatically manages CPU and memory limits for virtual machines. + +By default, {VirtProductName} computes resource requests for a virtual machine. When you enable the `AutoResourceLimits` feature gate, {VirtProductName} also computes resource limits to meet namespace quota requirements. + +If a namespace enforces both CPU and memory quotas and requires limits to be set, enabling the `AutoResourceLimits` feature gate is recommended. When this feature is enabled, the memory limit is automatically set to double the base memory allocation and the CPU limit is set to one per vCPU. + +[NOTE] +==== +You can customize the memory limit ratio for a specific namespace by adding the `alpha.kubevirt.io/auto-memory-limits-ratio` annotation. + +For example, the following command sets the ratio to 1.2 for the `my-virtualization-project` namespace: + +[source,terminal] +---- +$ oc annotate namespace my-virtualization-project alpha.kubevirt.io/auto-memory-limits-ratio=1.2 +---- +==== + +.Procedure + +To enable automatic resource quota limits for virtual machines, perform the following steps: + +. Edit the `HyperConverged` custom resource (CR) by running the following command: ++ +[source,terminal] +---- +$ oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv +---- + +. In the `spec.featureGates` section, add or set the `autoResourceLimits` parameter to `true`: ++ +[source,yaml] +---- +spec: + featureGates: + autoResourceLimits: true +---- + +. Save the changes and exit the editor. + +== Manually setting resource quota limits for virtual machines Resource quotas that only use requests automatically work with virtual machines (VMs). If your resource quota uses limits, you must manually set resource limits on VMs. Resource limits must be at least 100 MiB larger than resource requests. +[WARNING] +==== +Manual management of resource quota limits is not recommended. It is recommended to enable automatic resource quota limit computation instead, as described in the previous section. Manual limit settings can lead to quota misconfigurations or scheduling issues. +==== + .Procedure . Set limits for a VM by editing the `VirtualMachine` manifest. For example: @@ -32,4 +79,4 @@ spec: ---- <1> This configuration is supported because the `limits.memory` value is at least `100Mi` larger than the `requests.memory` value. -. Save the `VirtualMachine` manifest. +. Save the `VirtualMachine` manifest. \ No newline at end of file