// Module included in the following assemblies:
//
// * ai_workloads/kueue/configuring-quotas.adoc

:_mod-docs-content-type: PROCEDURE
[id="configuring-clusterqueues_{context}"]
= Configuring a cluster queue

A cluster queue is a cluster-scoped resource, represented by a `ClusterQueue` object, that governs a pool of resources such as CPU, memory, and pods.
Cluster queues can be used to define usage limits, quotas for resource flavors, order of consumption, and fair sharing rules.

[NOTE]
====
The cluster queue is not ready for use until a `ResourceFlavor` object has also been configured.
====

.Prerequisites

include::snippets/prereqs-snippet-yaml.adoc[]

.Procedure

. Create a `ClusterQueue` object as a YAML file:
+
.Example of a basic `ClusterQueue` object using a single resource flavor
[source,yaml]
----
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
  name: cluster-queue
spec:
  namespaceSelector: {} # <1>
  resourceGroups:
  - coveredResources: ["cpu", "memory", "pods", "foo.com/gpu"] # <2>
    flavors:
    - name: "default-flavor" # <3>
      resources: # <4>
      - name: "cpu"
        nominalQuota: 9
      - name: "memory"
        nominalQuota: 36Gi
      - name: "pods"
        nominalQuota: 5
      - name: "foo.com/gpu"
        nominalQuota: 100
----
<1> Defines which namespaces can use the resources governed by this cluster queue. An empty `namespaceSelector` as shown in the example means that all namespaces can use these resources.
<2> Defines the resource types governed by the cluster queue. This example `ClusterQueue` object governs CPU, memory, pod, and GPU resources.
<3> Defines the resource flavor that is applied to the resource types listed. In this example, the `default-flavor` resource flavor is applied to CPU, memory, pod, and GPU resources.
<4> Defines the resource requirements for admitting jobs. This example cluster queue only admits jobs if the following conditions are met:
+
* The sum of the CPU requests is less than or equal to 9.
* The sum of the memory requests is less than or equal to 36Gi.
* The total number of pods is less than or equal to 5.
* The sum of the GPU requests is less than or equal to 100.

. Apply the `ClusterQueue` object by running the following command:
+
[source,terminal]
----
$ oc apply -f <filename>.yaml
----
