-
Notifications
You must be signed in to change notification settings - Fork 479
Description
What happened:
We've observed that inactive workloads (.spec.active=false) occasionally get admitted and are then immediately evicted.
After investigation, we found this is triggered by runtime class reconciliation, which pushes all pending workloads back onto the internal heap, regardless of their active status. This causes the scheduler to consider them, even though they're inactive.
The main workload controller correctly checks .spec.active before adding workloads to the heap. However, this check is missing in other situations.
What you expected to happen:
We’d expect Kueue to consistently avoid scheduling inactive workloads, regardless of the trigger.
How to reproduce it (as minimally and precisely as possible):
- Apply the test setup below.
- Annotate the RuntimeClass:
kubectl annotate runtimeclass test-kueue-class foo=bar
This will trigger the code mentioned above, and you’ll see the following events in the workload:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal QuotaReserved 2s kueue-admission Quota reserved in ClusterQueue test-cluster-queue, wait time since queued was 14s
Normal Admitted 2s kueue-admission Admitted by ClusterQueue test-cluster-queue, wait time since reservation was 0s
Normal EvictedDueToDeactivated 2s kueue-workload-controller The workload is deactivated
Example spec:
---
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: test-kueue-class
handler: myconfiguration
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
name: test-rf
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
name: test-cluster-queue
spec:
namespaceSelector: {} # match all.
resourceGroups:
- coveredResources: ["cpu", "memory"]
flavors:
- name: "test-rf"
resources:
- name: "cpu"
nominalQuota: 10
- name: "memory"
nominalQuota: 2Gi
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: LocalQueue
metadata:
name: test-local-queue
spec:
clusterQueue: test-cluster-queue
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: Workload
metadata:
name: test-wl-1
spec:
active: false
podSets:
- count: 1
name: main
template:
spec:
runtimeClassName: test-kueue-class
containers:
- name: demo
resources:
limits:
cpu: "1"
memory: 128Mi
requests:
cpu: "1"
memory: 128Mi
queueName: test-local-queue
Environment:
- Kubernetes version (use
kubectl version): v1.31.6 - Kueue version (use
git describe --tags --dirty --always): 0.13.0