﻿# Kueue elastic scale-up must charge a replacement slice once

Elastic workload replacement can overlap in object lifetime; Kueue 0.20.6 prevents that overlap from double charging ClusterQueue usage.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-ops-kueue-elastic-slice-single-charge/
Language: en

Kueue 0.20.6 fixes temporary double charging while an elastic workload slice is replaced during scale-up. The old slice and its replacement could both count against ClusterQueue usage, briefly exceeding quota and blocking or preempting unrelated workloads. This is an accounting transition problem: a momentary overlap in controller objects must not automatically become two independent claims on the same logical allocation.

## Logical ownership survives object replacement

PR 18648 backports a cache accounting fix for ElasticJobsViaWorkloadSlices. Its release note concerns a replacement relation, not two separately admitted jobs. That distinction should appear in a regression fixture: identify the old slice, its successor and the allocation they represent. Without this mapping, a test can misclassify a legitimate increase in requested work as double charging, or mistakenly deduplicate genuinely independent allocations merely because their resource quantities happen to match.

## A short spike can change other decisions

The upstream note names both blocking and preemption as possible consequences. A usage spike that disappears in the next reconciliation is therefore not necessarily harmless telemetry noise. A proposed qualification scenario keeps another workload waiting near the quota boundary while scaling the elastic job. Record admission and eviction decisions during the transition, not just the final usage gauge. This connects the accounting invariant to the scheduling side effects that motivated the patch.

## Observe transitions at sufficient resolution

A dashboard scraped less often than the replacement interval can miss the erroneous peak entirely. Controller events and object transitions are useful complementary evidence. The proposed check should correlate their ordering with quota accounting, while acknowledging that independently scraped gauges are not an atomic snapshot. The release does not provide a duration or frequency estimate for the bug, so no universal sampling interval can be inferred from the existence of the fix.

## Do not subtract real scale-up demand

Single charging does not mean freezing usage at the old slice size. The replacement may legitimately request more resources as the elastic job grows. A useful assertion compares the accounted amount with the intended successor allocation at each defined handoff, rather than insisting that usage never increases. The patch repairs duplicate ownership during replacement; ordinary quota limits, competition and valid preemption decisions still apply to the additional capacity the workload genuinely asks for.

## Sources

- [kubernetes-sigs/kueue v0.20.6 release notes](https://github.com/kubernetes-sigs/kueue/releases/tag/v0.20.6)
- [[release-0.20] Cache: charge an elastic job once while its workload slice is replaced by k8s-infra-cherrypick-robot](https://github.com/kubernetes-sigs/kueue/pull/18648)

## Related reading

- [GPUs in Kubernetes: scheduling CPU, RAM and accelerators together](/journal/kubernetes-gpu-scheduling/)
- [Queue age and starvation: retain waiting membership, not only queue count](/journal/field-observe-queue-age-starvation-membership/)
