|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * configure/using-cohorts.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: CONCEPT |
| 6 | +[id="resource-groups-flavors_{context}"] |
| 7 | += Resource groups and flavors |
| 8 | + |
| 9 | +You can configure resource groups within cluster queues to define a list of resources and a list of flavors that provide quotas for these resources. |
| 10 | +Each resource type and flavor can only belong to one resource group. |
| 11 | + |
| 12 | +.Example of a basic `ClusterQueue` object with resource groups defined |
| 13 | +[source,yaml] |
| 14 | +---- |
| 15 | +apiVersion: kueue.x-k8s.io/v1beta1 |
| 16 | +kind: ClusterQueue |
| 17 | +metadata: |
| 18 | + name: example-queue |
| 19 | +spec: |
| 20 | + namespaceSelector: {} |
| 21 | + resourceGroups: # <1> |
| 22 | + - coveredResources: ["cpu", "memory"] # <2> |
| 23 | + flavors: |
| 24 | + - name: "resource-flavor-a" # <3> |
| 25 | + resources: |
| 26 | + - name: "cpu" |
| 27 | + nominalQuota: 9 |
| 28 | + - name: "memory" |
| 29 | + nominalQuota: 36Gi |
| 30 | + - coveredResources: ["pods", "foo.com/gpu"] # <4> |
| 31 | + flavors: |
| 32 | + - name: "resource-flavor-b" # <5> |
| 33 | + resources: # <4> |
| 34 | + - name: "pods" |
| 35 | + nominalQuota: 5 |
| 36 | + - name: "foo.com/gpu" |
| 37 | + nominalQuota: 100 |
| 38 | +---- |
| 39 | +<1> You can define up to 16 resource groups for your cluster. |
| 40 | +<2> Defines the resource types governed the first resource group. This resource group governs CPU and memory resources. |
| 41 | +<3> Defines the resource flavor that is applied to the resource types listed in the first resource group. In this example, the `resource-flavor-a` resource flavor is applied to CPU and memory. |
| 42 | +<4> Defines the resource types governed the second resource group. This resource group governs pods and GPU resources. |
| 43 | +<5> Defines the resource flavor that is applied to the resource types listed in the second resource group. In this example, the `resource-flavor-b` resource flavor is applied to pods and GPU. |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +When a ClusterQueue is part of a cohort, Kueue satisfies the following admission semantics: |
| 48 | + |
| 49 | +When assigning flavors, Kueue goes through the list of flavors in the relevant ResourceGroup inside ClusterQueue’s (.spec.resourceGroups[*].flavors). For each flavor, Kueue attempts to fit a Workload’s pod set according to the quota defined in the ClusterQueue for the flavor and the unused quota in the cohort. If the Workload doesn’t fit, Kueue evaluates the next flavor in the list. |
| 50 | +A Workload’s pod set resource fits in a flavor defined for a ClusterQueue resource if the sum of requests for the resource: |
| 51 | +Is less than or equal to the unused nominalQuota for the flavor in the ClusterQueue; or |
| 52 | +Is less than or equal to the sum of unused nominalQuota for the flavor in the ClusterQueues in the cohort, and |
| 53 | +Is less than or equal to the unused nominalQuota + borrowingLimit for the flavor in the ClusterQueue. In Kueue, when (2) and (3) are satisfied, but not (1), this is called borrowing quota. |
| 54 | +A ClusterQueue can only borrow quota for flavors that the ClusterQueue defines. |
| 55 | +For each pod set resource in a Workload, a ClusterQueue can only borrow quota for one flavor. |
0 commit comments