| STEP |
EXPECTED RESULT |
TEST_ID=$(printf "%04x" $RANDOM)
echo "Test ID: $TEST_ID"
|
Test ID: a3f2
A 4-digit hex value (example shown)
|
cat <<EOF | oc apply -f -
apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
name: resource-flavor-${TEST_ID}
EOF
|
resourceflavor.kueue.x-k8s.io/resource-flavor-a3f2 created
|
oc get resourceflavors resource-flavor-${TEST_ID}
|
NAME AGE
resource-flavor-a3f2 5s
|
cat <<EOF | oc apply -f -
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
name: cluster-queue-a-${TEST_ID}
spec:
namespaceSelector: {}
resourceGroups:
- coveredResources: ["cpu", "memory"]
flavors:
- name: resource-flavor-${TEST_ID}
resources:
- name: "cpu"
nominalQuota: 1
- name: "memory"
nominalQuota: 1Gi
EOF
|
clusterqueue.kueue.x-k8s.io/cluster-queue-a-a3f2 created
|
oc get clusterqueue cluster-queue-a-${TEST_ID}
|
NAME COHORT STRATEGY PENDING WORKLOADS ADMITTED WORKLOADS AGE
cluster-queue-a-a3f2 BestEffortFIFO 0 0 5s
|
cat <<EOF | oc apply -f -
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
name: cluster-queue-b-${TEST_ID}
spec:
namespaceSelector: {}
resourceGroups:
- coveredResources: ["cpu", "memory"]
flavors:
- name: resource-flavor-${TEST_ID}
resources:
- name: "cpu"
nominalQuota: 1
- name: "memory"
nominalQuota: 1Gi
EOF
|
clusterqueue.kueue.x-k8s.io/cluster-queue-b-a3f2 created
|
oc get clusterqueue cluster-queue-b-${TEST_ID}
|
NAME COHORT STRATEGY PENDING WORKLOADS ADMITTED WORKLOADS AGE
cluster-queue-b-a3f2 BestEffortFIFO 0 0 5s
|
oc get clusterqueues | grep ${TEST_ID}
|
cluster-queue-a-a3f2 5s
cluster-queue-b-a3f2 3s
|
cat <<EOF | oc apply -f -
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority-${TEST_ID}
value: 100
globalDefault: false
description: "High priority class for testing"
EOF
|
priorityclass.scheduling.k8s.io/high-priority-a3f2 created
|
cat <<EOF | oc apply -f -
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: medium-priority-${TEST_ID}
value: 75
globalDefault: false
description: "Medium priority class for testing"
EOF
|
priorityclass.scheduling.k8s.io/medium-priority-a3f2 created
|
cat <<EOF | oc apply -f -
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: low-priority-${TEST_ID}
value: 50
globalDefault: false
description: "Low priority class for testing"
EOF
|
priorityclass.scheduling.k8s.io/low-priority-a3f2 created
|
oc get priorityclasses | grep ${TEST_ID}
|
high-priority-a3f2 100 false 5s
medium-priority-a3f2 75 false 4s
low-priority-a3f2 50 false 3s
|
cat <<EOF | oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: namespace-a-${TEST_ID}
labels:
kueue.openshift.io/managed: "true"
EOF
|
namespace/namespace-a-a3f2 created
|
oc get namespace namespace-a-${TEST_ID}
|
NAME STATUS AGE
namespace-a-a3f2 Active 10s
|
cat <<EOF | oc apply -f -
apiVersion: kueue.x-k8s.io/v1beta1
kind: LocalQueue
metadata:
name: local-queue-a-${TEST_ID}
namespace: namespace-a-${TEST_ID}
spec:
clusterQueue: cluster-queue-a-${TEST_ID}
EOF
|
localqueue.kueue.x-k8s.io/local-queue-a-a3f2 created
|
oc get localqueue -n namespace-a-${TEST_ID}
|
NAME CLUSTERQUEUE STATUS AGE
local-queue-a-a3f2 cluster-queue-a-a3f2 Active 5s
|
cat <<EOF | oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: namespace-b-${TEST_ID}
labels:
kueue.openshift.io/managed: "true"
EOF
|
namespace/namespace-b-a3f2 created
|
oc get namespace namespace-b-${TEST_ID}
|
NAME STATUS AGE
namespace-b-a3f2 Active 10s
|
cat <<EOF | oc apply -f -
apiVersion: kueue.x-k8s.io/v1beta1
kind: LocalQueue
metadata:
name: local-queue-b-${TEST_ID}
namespace: namespace-b-${TEST_ID}
spec:
clusterQueue: cluster-queue-b-${TEST_ID}
EOF
|
localqueue.kueue.x-k8s.io/local-queue-b-a3f2 created
|
oc get localqueue -n namespace-b-${TEST_ID}
|
NAME CLUSTERQUEUE STATUS AGE
local-queue-b-a3f2 cluster-queue-b-a3f2 Active 5s
|
oc get localqueues --all-namespaces | grep ${TEST_ID}
|
namespace-a-a3f2 local-queue-a-a3f2 cluster-queue-a-a3f2 Active 5s
namespace-b-a3f2 local-queue-b-a3f2 cluster-queue-b-a3f2 Active 3s
|
cat <<EOF | oc apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
name: kueue-test-user-${TEST_ID}
namespace: namespace-a-${TEST_ID}
EOF
|
serviceaccount/kueue-test-user-a3f2 created
|
oc get serviceaccount -n namespace-a-${TEST_ID} kueue-test-user-${TEST_ID}
|
NAME SECRETS AGE
kueue-test-user-a3f2 1 5s
|
cat <<EOF | oc apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pending-workloads-admin-${TEST_ID}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kueue-batch-admin-role
subjects:
- kind: ServiceAccount
name: kueue-test-user-${TEST_ID}
namespace: namespace-a-${TEST_ID}
EOF
|
clusterrolebinding.rbac.authorization.k8s.io/pending-workloads-admin-a3f2 created
|
oc get clusterrolebinding pending-workloads-admin-${TEST_ID}
|
NAME ROLE AGE
pending-workloads-admin-a3f2 ClusterRole/kueue-batch-admin-role 5s
|
| STEP |
EXPECTED RESULT |
cat <<EOF | oc apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: job-blocker
namespace: namespace-a-${TEST_ID}
labels:
kueue.x-k8s.io/queue-name: local-queue-a-${TEST_ID}
spec:
parallelism: 1
completions: 1
template:
spec:
priorityClassName: high-priority-${TEST_ID}
restartPolicy: Never
containers:
- name: test-container
image: busybox
command: ["sh", "-c", "echo 'Hello Kueue'; sleep 30"]
resources:
requests:
cpu: "1"
memory: "1Gi"
EOF
|
job.batch/job-blocker created
|
cat <<EOF | oc apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: job-high-a
namespace: namespace-a-${TEST_ID}
labels:
kueue.x-k8s.io/queue-name: local-queue-a-${TEST_ID}
spec:
parallelism: 1
completions: 1
template:
spec:
priorityClassName: high-priority-${TEST_ID}
restartPolicy: Never
containers:
- name: test-container
image: busybox
command: ["sh", "-c", "echo 'Hello Kueue'; sleep 30"]
resources:
requests:
cpu: "1"
memory: "1Gi"
EOF
|
job.batch/job-high-a created
|
cat <<EOF | oc apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: job-medium-a
namespace: namespace-a-${TEST_ID}
labels:
kueue.x-k8s.io/queue-name: local-queue-a-${TEST_ID}
spec:
parallelism: 1
completions: 1
template:
spec:
priorityClassName: medium-priority-${TEST_ID}
restartPolicy: Never
containers:
- name: test-container
image: busybox
command: ["sh", "-c", "echo 'Hello Kueue'; sleep 30"]
resources:
requests:
cpu: "1"
memory: "1Gi"
EOF
|
job.batch/job-medium-a created
|
cat <<EOF | oc apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: job-low-a
namespace: namespace-a-${TEST_ID}
labels:
kueue.x-k8s.io/queue-name: local-queue-a-${TEST_ID}
spec:
parallelism: 1
completions: 1
template:
spec:
priorityClassName: low-priority-${TEST_ID}
restartPolicy: Never
containers:
- name: test-container
image: busybox
command: ["sh", "-c", "echo 'Hello Kueue'; sleep 30"]
resources:
requests:
cpu: "1"
memory: "1Gi"
EOF
|
job.batch/job-low-a created
|
oc get jobs -n namespace-a-${TEST_ID}
|
NAME COMPLETIONS DURATION AGE
job-blocker 0/1 5s 5s
job-high-a 0/1 3s 3s
job-medium-a 0/1 2s 2s
job-low-a 0/1 1s 1s
|
cat <<EOF | oc apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: job-blocker-b
namespace: namespace-b-${TEST_ID}
labels:
kueue.x-k8s.io/queue-name: local-queue-b-${TEST_ID}
spec:
parallelism: 1
completions: 1
template:
spec:
priorityClassName: high-priority-${TEST_ID}
restartPolicy: Never
containers:
- name: test-container
image: busybox
command: ["sh", "-c", "echo 'Hello Kueue'; sleep 30"]
resources:
requests:
cpu: "1"
memory: "1Gi"
EOF
|
job.batch/job-blocker-b created
|
cat <<EOF | oc apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: job-high-b
namespace: namespace-b-${TEST_ID}
labels:
kueue.x-k8s.io/queue-name: local-queue-b-${TEST_ID}
spec:
parallelism: 1
completions: 1
template:
spec:
priorityClassName: high-priority-${TEST_ID}
restartPolicy: Never
containers:
- name: test-container
image: busybox
command: ["sh", "-c", "echo 'Hello Kueue'; sleep 30"]
resources:
requests:
cpu: "1"
memory: "1Gi"
EOF
|
job.batch/job-high-b created
|
oc get jobs -n namespace-b-${TEST_ID}
|
NAME COMPLETIONS DURATION AGE
job-blocker-b 0/1 5s 5s
job-high-b 0/1 3s 3s
|
oc get workloads -n namespace-a-${TEST_ID}
|
NAME QUEUE ADMITTED BY AGE
job-blocker-xyz local-queue-a-a3f2 cluster-queue-a-a3f2 10s
job-high-a-abc local-queue-a-a3f2 8s
job-medium-a-def local-queue-a-a3f2 7s
job-low-a-ghi local-queue-a-a3f2 6s
|
oc get workloads -n namespace-b-${TEST_ID}
|
NAME QUEUE ADMITTED BY AGE
job-blocker-b-xyz local-queue-b-a3f2 cluster-queue-b-a3f2 10s
job-high-b-abc local-queue-b-a3f2 8s
|
oc get pods -n namespace-a-${TEST_ID}
|
NAME READY STATUS RESTARTS AGE
job-blocker-xyz-pod 1/1 Running 0 8s
|
oc get pods -n namespace-b-${TEST_ID}
|
NAME READY STATUS RESTARTS AGE
job-blocker-b-xyz-pod 1/1 Running 0 8s
|
| STEP |
EXPECTED RESULT |
oc get workloads -n namespace-a-${TEST_ID} -o json | \
jq '.items[] | select(.metadata.ownerReferences[].name=="job-blocker") | {name: .metadata.name, admitted: (.status.conditions[] | select(.type=="Admitted") | .status)}'
|
{
"name": "job-blocker-xyz",
"admitted": "True"
}
|
oc get workloads -n namespace-a-${TEST_ID} -o wide
|
NAME QUEUE ADMITTED BY PRIORITY AGE
job-blocker-xyz local-queue-a-a3f2 cluster-queue-a-a3f2 100 15s
job-high-a-abc local-queue-a-a3f2 100 12s
job-medium-a-def local-queue-a-a3f2 75 10s
job-low-a-ghi local-queue-a-a3f2 50 8s
|
oc get workloads -n namespace-a-${TEST_ID} -o json | \
jq '.items[] | select(.status.conditions[] | select(.type=="Admitted" and .status=="False")) | {name: .metadata.name, priority: .spec.priority}' | \
jq -s 'sort_by(.priority) | reverse'
|
[
{
"name": "job-high-a-abc",
"priority": 100
},
{
"name": "job-medium-a-def",
"priority": 75
},
{
"name": "job-low-a-ghi",
"priority": 50
}
]
|
oc describe clusterqueue cluster-queue-a-${TEST_ID}
|
Name: cluster-queue-a-a3f2
Namespace:
Labels: <none>
Annotations: <none>
API Version: kueue.x-k8s.io/v1beta1
Kind: ClusterQueue
...
Status:
Admitted Workloads: 1
Pending Workloads: 3
Reserving Workloads: 1
...
|
watch -n 2 "oc get workloads -A | grep ${TEST_ID}"
|
namespace-a-a3f2 job-blocker-xyz local-queue-a-a3f2 cluster-queue-a-a3f2 100 15s
namespace-a-a3f2 job-high-a-abc local-queue-a-a3f2 100 12s
namespace-a-a3f2 job-medium-a-def local-queue-a-a3f2 75 10s
namespace-a-a3f2 job-low-a-ghi local-queue-a-a3f2 50 8s
namespace-b-a3f2 job-blocker-b-xyz local-queue-b-a3f2 cluster-queue-b-a3f2 100 10s
namespace-b-a3f2 job-high-b-abc local-queue-b-a3f2 100 8s
Monitor as workloads transition from pending → admitted → finished
|
oc get workloads -n namespace-a-${TEST_ID} -o json | \
jq '.items[] | {name: .metadata.name, finished: (.status.conditions[] | select(.type=="Finished") | .status)}'
|
{
"name": "job-blocker-xyz",
"finished": "True"
}
{
"name": "job-high-a-abc",
"finished": "True"
}
{
"name": "job-medium-a-def",
"finished": "True"
}
{
"name": "job-low-a-ghi",
"finished": "True"
}
|
oc get workloads -A | grep ${TEST_ID} | grep -v Finished
|
# Should return no items (empty output)
# All workloads should have "Finished" status
|
| STEP |
EXPECTED RESULT |
oc delete jobs --all -n namespace-a-${TEST_ID}
oc delete jobs --all -n namespace-b-${TEST_ID}
|
job.batch "job-blocker" deleted
job.batch "job-high-a" deleted
job.batch "job-medium-a" deleted
job.batch "job-low-a" deleted
job.batch "job-blocker-b" deleted
job.batch "job-high-b" deleted
|
oc get jobs -n namespace-a-${TEST_ID}
oc get jobs -n namespace-b-${TEST_ID}
|
No resources found in namespace-a-a3f2 namespace.
No resources found in namespace-b-a3f2 namespace.
|
oc delete namespace namespace-a-${TEST_ID}
oc delete namespace namespace-b-${TEST_ID}
|
namespace "namespace-a-a3f2" deleted
namespace "namespace-b-a3f2" deleted
|
oc delete clusterqueue cluster-queue-a-${TEST_ID}
oc delete clusterqueue cluster-queue-b-${TEST_ID}
|
clusterqueue.kueue.x-k8s.io "cluster-queue-a-a3f2" deleted
clusterqueue.kueue.x-k8s.io "cluster-queue-b-a3f2" deleted
|
oc delete resourceflavor resource-flavor-${TEST_ID}
|
resourceflavor.kueue.x-k8s.io "resource-flavor-a3f2" deleted
|
oc delete priorityclass high-priority-${TEST_ID}
oc delete priorityclass medium-priority-${TEST_ID}
oc delete priorityclass low-priority-${TEST_ID}
|
priorityclass.scheduling.k8s.io "high-priority-a3f2" deleted
priorityclass.scheduling.k8s.io "medium-priority-a3f2" deleted
priorityclass.scheduling.k8s.io "low-priority-a3f2" deleted
|
oc get all,clusterqueues,localqueues,resourceflavors,priorityclasses -A | grep ${TEST_ID}
|
# Should return no output (all resources deleted)
|