﻿# Kueue preserves preferred-affinity scores when topology node matching hits cache

Warm node-match caches must retain preferred-affinity scores as well as eligibility; 0.20.6 fixes preference loss on the cached TAS path.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-ops-kueue-tas-cache-preferred-affinity/
Language: en

The November Kueue release fixes preferred node affinity being ignored when TASCacheNodeMatchResults reused cached node matches. Affected configurations enable TASRespectNodeAffinityPreferred. Eligibility caching and preference scoring are related but different outputs: knowing that a node can run a Pod does not preserve how strongly that node should be preferred. The patch keeps the preference semantics from disappearing on the warm-cache path.

## A boolean match is not a preference score

PR 18436 says preferred affinity could be ignored on reused node matches. A cache sufficient for eligibility decisions can be incomplete for ranking decisions. A proposed fixture uses multiple eligible domains with different preferred-affinity scores so that losing the score changes the ranking. If only one domain is eligible, or all scores agree, a correct-looking placement cannot distinguish the old cache behavior from the repaired implementation.

## Cold and warm paths need the same semantics

Qualification should exercise an initial computation and a subsequent cache hit under equivalent relevant inputs, then compare ranking evidence. Recreating the entire manager between attempts would clear the state being tested. The expected invariant is preservation of preference information when matches are reused, not byte-identical internal cache representation. Keep node labels and workload affinity stable during the comparison so an unrelated configuration change does not explain a different placement.

## Gate combinations define the affected path

The release explicitly names TASRespectNodeAffinityPreferred and TASCacheNodeMatchResults. A proposed matrix keeps preference handling enabled while comparing cached and uncached matching, then includes a control without the preference feature. This isolates the interaction instead of attributing all topology decisions to the cache. The patch does not claim that preferred affinity becomes a hard requirement; it repairs the score used where the enabled scheduling behavior is supposed to respect preferences.

## Caching must preserve meaning before speed matters

The release contains a correctness fix, not a cache-speed benchmark. Any evaluation of reduced matching cost should first establish equivalent ranking semantics on cold and warm paths. Only then can runtime or reconciliation observations describe a valid optimization. The operational conclusion is narrower and useful: a warm cache should not make a workload lose its configured preference. Remaining placement differences still need the full topology constraints and comparator ordering to explain them.

## Sources

- [kubernetes-sigs/kueue v0.20.6 release notes](https://github.com/kubernetes-sigs/kueue/releases/tag/v0.20.6)
- [[release-0.20] TAS: keep preferred affinity scores on a match cache hit by k8s-infra-cherrypick-robot](https://github.com/kubernetes-sigs/kueue/pull/18436)

## Related reading

- [Kubernetes 1.36: topology placement for a PodGroup](/journal/kubernetes-136-podgroup-topology-placement/)
- [Keep topology-spread selectors aligned during a rollout](/journal/guide-ks-spread-label-change/)
